为什么 git pull 挂起?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44031150/
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
Why does git pull hang?
提问by user3685285
When I do a git pull
, from the git bash, the terminal usually runs the pull, updates my local, and then hangs. I'm not sure if it's waiting for me to do something, but I usually exit out of this with CTRL-C
. After that, I get that an index.lock is preventing me from doing other things to which I have to delete it. Am I misunderstanding how git pull
works?
当我git pull
从 git bash执行 a 时,终端通常会运行 pull,更新我的本地,然后挂起。我不确定它是否在等我做某事,但我通常用CTRL-C
. 在那之后,我发现 index.lock 阻止我做其他必须删除它的事情。我误解了git pull
工作原理吗?
回答by Akif
You may need to remove unnecessary git objects such as dangling commits & blobs
:
您可能需要删除不必要的 git 对象,例如dangling commits & blobs
:
git fsck && git gc --prune=now
git-fsck: Verifies the connectivity and validity of the objects in the database
git-gc: Cleanup unnecessary files and optimize the local repository
You can refer hereabout dangling commits & blobs
.
你可以参考这里关于dangling commits & blobs
.
回答by zachaysan
If you are pulling from a linux machine you may want to check this file:
如果您是从 linux 机器上拉取数据,您可能需要检查此文件:
/etc/ssh/ssh_config
/etc/ssh/ssh_config
To make sure you aren't setting your default SSH port to something other than 22. Some people get confused between that file and:
确保您没有将默认 SSH 端口设置为 22 以外的其他端口。有些人对该文件和以下内容感到困惑:
/etc/ssh/sshd_config
/etc/ssh/sshd_config
When they're setting up servers to a non-standard SSH port.
当他们将服务器设置为非标准 SSH 端口时。
回答by Barry Kelly
Check SSH_AUTH_SOCK isn't pointing at a stale ssh-agent endpoint. Unset it (unset SSH_AUTH_SOCK
) to test.
检查 SSH_AUTH_SOCK 是否指向过时的 ssh-agent 端点。取消设置 ( unset SSH_AUTH_SOCK
) 以进行测试。
回答by Zac
I am in Windows, and I solved the hang by closing the Visual Studio before doing the pull.
我在 Windows 中,我通过在拉取之前关闭 Visual Studio 解决了挂起问题。
回答by augusto
Had same issue, which was related to my ssh client.
有同样的问题,这与我的 ssh 客户端有关。
This was confirmed trying to connect to a remote ssh server with the '-v' (verbose) option
已确认尝试使用“-v”(详细)选项连接到远程 ssh 服务器
ssh -v -p PORTNUMBER USERNAME@SERVER
which gave rekey after XXXXXX blocks”
before getting stuck.
rekey after XXXXXX blocks”
在卡住之前就给 了。
apt-get purge
and apt-get install
didn't help, so - before facing the interestign approach here exposed at https://apple.stackexchange.com/a/280800- I went for an easy reboot, which did the job.
apt-get purge
并 apt-get install
没有帮助,所以 - 在面对https://apple.stackexchange.com/a/280800 上公开的有趣方法之前 - 我进行了轻松重启,这完成了工作。