git 回购同步挂起
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2091474/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Repo sync hangs
提问by rahul
I was trying to get the sources for the Android 1.6 release, but the repo sync operation keeps hanging.
我试图获取 Android 1.6 版本的源代码,但 repo 同步操作一直挂起。
I am pasting the last part of the message i get on the terminal here:
我正在粘贴我在终端上收到的消息的最后一部分:
Fetching projects: 19% (32/164)
Initializing project platform/external/freetype ...
remote: Counting objects: 970, done.
remote: Compressing objects: 100% (414/414), done.
Receiving objects: 57% (558/970), 1.28 MiB | 26 KiB/s
It just hangs there... no error messages or aything of that sort.
它只是挂在那里......没有错误消息或类似的东西。
Has anyone faced a similar issue?
有没有人遇到过类似的问题?
回答by Trenado
I wonder if you are using VMWare to run Linux. I experienced the same problem as you until I've found what was causing it: the tcp window size on our side being set to 0 (full). I am running Ubuntu 10.04 on VMWare on Windows 7 64-bit as host. To fix it just make sure you give plenty of RAM to Ubuntu on VMWare to discard any memory issues. I had mine set to 512MB and increase it to 1.5M for better performance. Then the most important setting (and the one that did the trick actually): make sure you set the network adapter on VMWare to bridged mode. If using NAT for example, the NAT service will choke and mess the window size for you.
我想知道您是否正在使用 VMWare 来运行 Linux。我遇到了和你一样的问题,直到我找到了导致它的原因:我们这边的 tcp 窗口大小被设置为 0(满)。我在 Windows 7 64 位作为主机的 VMWare 上运行 Ubuntu 10.04。要修复它,请确保在 VMWare 上为 Ubuntu 提供足够的 RAM 以丢弃任何内存问题。我将我的设置为 512MB 并将其增加到 1.5M 以获得更好的性能。然后是最重要的设置(也是真正起作用的设置):确保将 VMWare 上的网络适配器设置为桥接模式。例如,如果使用 NAT,NAT 服务将为您阻塞并弄乱窗口大小。
Cause: The TCP window size of a client tells the server the number of bytes it is willing to receive at one time from the server; this is the client's receive window. When the window is set to 0 it means that the client won't be able to receive any more data until it process whatever data is still pending in its internal buffers. This is normal TCP stuff. The size effect of a window set to 0 on a client is that a TCP connection will still be alive for some time until the server decides he has waiting enough and kill the connection. This is what was causing my repo sync to hang with no errors.
原因:客户端的TCP窗口大小告诉服务器它一次愿意从服务器接收的字节数;这是客户端的接收窗口。当窗口设置为 0 时,这意味着客户端将无法接收更多数据,直到它处理其内部缓冲区中仍待处理的任何数据。这是正常的 TCP 东西。客户端上设置为 0 的窗口大小的影响是 TCP 连接仍将处于活动状态一段时间,直到服务器决定他已等待足够多并终止连接。这就是导致我的 repo 同步挂起而没有错误的原因。
回答by Vishnudas P
Hope this helps someone referring this forum.
希望这有助于有人提到这个论坛。
I have had this issue of git clones of large repositories hanging. Initially the speed will be high and then comes down drastically and finally it hangs. It was a issue with TCP Window Scaling. Once that was disabled, it was working fine.
我遇到过大型存储库的 git 克隆挂起的问题。最初速度会很高,然后急剧下降,最后挂起。这是 TCP 窗口缩放的问题。一旦禁用,它就可以正常工作。
(But the strange part is that when I ran it from Linux in VMWare, there was no issue.)
(但奇怪的是,当我在 VMWare 中从 Linux 运行它时,没有问题。)
To disable this for current session $ sudo sysctl -w net.ipv4.tcp_window_scaling=0
为当前会话禁用此功能 $ sudo sysctl -w net.ipv4.tcp_window_scaling=0
回答by VonC
There was a similar problem back in September on SO.
9 月份在 SO 上也有类似的问题。
It can be network speed related, or linked to the exact version of Git you are using.
If it is msysgit, please update to the latest version.
See also msysgit issue 361
它可能与网络速度有关,或链接到您正在使用的 Git 的确切版本。
如果是msysgit,请更新到最新版本。
另见msysgit 问题 361