Why does git pull hang?

你说的曾经没有我的故事 提交于 2020-01-22 05:43:19

问题


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?


回答1:


You may need to remove unnecessary git objects such as 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 here about dangling commits & blobs.




回答2:


I am in Windows, and I solved the hang by closing the Visual Studio before doing the pull.




回答3:


If you are pulling from a linux machine you may want to check this file:

/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:

/etc/ssh/sshd_config

When they're setting up servers to a non-standard SSH port.



来源:https://stackoverflow.com/questions/44031150/why-does-git-pull-hang

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