Git fetch/pull/clone hangs on receiving objects

白昼怎懂夜的黑 提交于 2019-11-27 03:49:15

VMware on NAT had this problem for me. Changing it to Bridged (replicate the state) fixed the issue.

Try to check your network connection. Maybe there is a garbage in the routing table. Maybe broken port on your router or your computer's network interface problem. Try to ping server from which you are cloning git repo, maybe link between your computer and this server is unstable.

driek

Looks similar to mine problem. Git seemed to hang on fetch or push after a certain short amount of time. I can advice you to put in ~/.ssh/config:

Host *

ServerAliveInterval 60

I have a MBP with also mountain lion. I hope this timeout is the cause for your problem. (After thirty or forty minutes or so, I noticed that it continued.)

On Mac, git fetch should be more resistant to this kind of issue, with Git 2.22 (Q2 2019): On platforms where "git fetch" is killed with SIGPIPE (e.g. OSX), the upload-pack that runs on the other end that hangs up after detecting an error could cause "git fetch" to die with a signal, which led to a flakey test.
"git fetch" now ignores SIGPIPE during the network portion of its operation (this is not a problem as we check the return status from our write(2)s).

See commit 1435889 (03 Mar 2019), and commit 37c8001 (05 Mar 2019) by Jeff King (peff).
(Merged by Junio C Hamano -- gitster -- in commit 27cdbdd, 20 Mar 2019)

fetch: ignore SIGPIPE during network operation

The default SIGPIPE behavior can be useful for a command that generates a lot of output: if the receiver of our output goes away, we'll be notified asynchronously to stop generating it (typically by killing the program).

But for a command like fetch, which is primarily concerned with receiving data and writing it to disk, an unexpected SIGPIPE can be awkward. We're already checking the return value of all of our write() calls, and dying due to the signal takes away our chance to gracefully handle the error.

On Linux, we wouldn't generally see SIGPIPE at all during fetch. If the other side of the network connection hangs up, we'll see ECONNRESET.
But on OS X, we get a SIGPIPE, and the process is killed.

Let's ignore SIGPIPE during the network portion of the fetch, which will cause our write() to return EPIPE, giving us consistent behavior across platforms.

Damian Wojcik

first try to initialize git repository folder by typing

$ git init

it should help

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!