Reputation: 6606
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?
Upvotes: 93
Views: 132920
Reputation: 581
Use -v
for verbosity. In my case
git pull -v upstream
gave
Looking up github.com ... done.
Connecting to github.com (port 9418) ...
so clearly something is wrong with connection on port 9418.
Thanks to the accepted answer in thread, I solved my issue by replacing
all git://
to https://
in .git/config
.
Upvotes: 0
Reputation: 766
I tried a number of the suggestions on this post to no avail. I was able to push, but not fetch/pull/clone from GitLab.
In my case installing the latest version for git (updating from v2.47.0.windows.1
to v2.47.0.windows.2
) resolved the issue for me. Although I suspect a simple reinstall of git would've done the trick as well.
Hope this helps someone running into a similar situation as me in the future.
Upvotes: 1
Reputation: 31
Some times this happen due a hang control master multiplexing connecction.
First check if you have one:
ssh -O check [email protected]
if you got Master running (pid=XXXXXXX)
then run:
ssh -O exit [email protected]
And try again.
Upvotes: 0
Reputation: 366
I'm using Windows, and the root cause turned out to be Git credentials. I had just recently changed my password. Visual Studio was opening a browser window to my Git repository, already nicely logged in, but Visual Studio never got word that the credentials were updated.
To fix it, I closed Visual Studio, navigated to my local repository in a command prompt, and manually did git pull
. This caused a Windows GUI prompt to enter my Git credentials, which allowed the pull to work. Opening again in Visual Studio it shows no pull is needed, as it is up-to-date.
Upvotes: 0
Reputation: 402
In my case it was internet connection problem. I was on some "guest" network and it denied pull with SSH keys. Switching to other network solved the issue
Upvotes: 0
Reputation: 101
in my case, patience is a virtue :)
I believe it was a significant amount of time since the last I did a pull in this particular clone so there was a lot of computing to do (compounded by a slow network)
I was about to Ctrl-C it until I came here to look at other answers only to go back and control had been returned (it “hung” for a good 5-10 min). While the pull didn’t complete the first time, I moved aside untracked changes that git warned might be lost, started the pull again and it completed.
Upvotes: 0
Reputation: 47
for me it's waiting for me to input credentials. I didn't notice a git popup appears asking me for password
Upvotes: 1
Reputation: 1101
A potential cause is the sshCommand git config.
I've followed AlexS advice from below question: Git for Windows - Asking for SSH passphrase every push
It's by no means bad advice, but it's not universal. My pull started hanging after assigning the variable. I guess the file path wasn't correct for my machine.
Removing it from git config file solved the git pull hanging issue.
Upvotes: 0
Reputation: 163
For me, port 22 (SSH port) was blocked by the university I was visiting (affecting the eduroam network). Instead, I started using port 443 (HTTPS port). To diagnose if port 22 is blocked you may compare if ssh -T -p 22 [email protected]
blocks and ssh -T -p 443 [email protected]
gives a message.
For a single repo, my solution was to add an alternative remote I called origin443
git remote add origin443 ssh://[email protected]:443/[USERNAME]/[REPO-NAME].git
To fix this problem regardless of repository you can update/add the ssh Github entry in your ~/.ssh/config
to always use 443 for Github. Use:
Host github.com
Hostname ssh.github.com
Port 443
User git
For more information see SSH over HTTPS on Github docs
Upvotes: 6
Reputation: 3074
I had the same problem. I tried all the solutions described here in the other answers, and nothing worked. Then I noticed that I'm only having this problem with one repo, and other repos were working fine.
I double checked that there is no "index.lock" file for the repo that was having the problem. Then I just deleted the entire folder and re-cloned the repo. Problem solved.
Upvotes: 0
Reputation: 8007
When going through all the resources/domains under my ~/.git/config
I started to test/ping/telnet all domains, one of them - simply didn't answer, its IP was changed. that caused the entire git pull
to hang...
Upvotes: 0
Reputation: 21
In my case, the 'git pull' hangs in the vscode terminal(zsh), which cannot display the password prompt. Using another shell (login via putty) other than in vscode to solve this problem
Upvotes: 2
Reputation: 1812
In my case, the problem was solved by switching ssh to use IPv4.
To do that, put AddressFamily inet
string into ~/.ssh/config
file.
Upvotes: 10
Reputation: 315
If you are in Linux, close and reopen the terminal and restart your ssh. Enter the following code in the terminal, and try again.
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/putHereYourSSHkey
ssh -T [email protected]
Upvotes: 1
Reputation: 793
I faced the same issue while using VSCode. I solved it by toggling off and on the GitHub: Git Authentication
setting (in User Settings (UI))
Upvotes: 1
Reputation: 4249
As someone who does not use VS Code very often, I too thought git was hanging when I ran git pull
. Turns out I was just not very observant. As illustrated in the image below, I was laser focused on the terminal and did not notice the prompt for a username which was the actual cause of the "hang".
Upvotes: 21
Reputation: 489
I updated git scm 2.32.0 to 2.33.1 version and problem with hanging fetch, push, pull was resolved
Upvotes: 2
Reputation: 641
My problem was that I had changed my ssh config file and this repository was using a non-existent ssh config.
To check remote config:
git remote -v
To check ssh config:
cat ~/.ssh/config
To fix it, I had to remove remote and add a new one:
git remote add origin
git remote add origin right-ssh-config
Upvotes: 0
Reputation: 331
On Fedora 32, all git commands were hanging for me (only for repos on gitlab), solved with
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
leaving this here in case it helps anyone else
Upvotes: 9
Reputation: 1307
Your ISP might be blocking the traffic. For example, VirginMedia in the UK does something with a proxy for their filters that causes GitHub traffic to hang. I had this issue, and disabling the filter fixed it.
Upvotes: 6
Reputation: 42182
Check SSH_AUTH_SOCK isn't pointing at a stale ssh-agent endpoint. Unset it (unset SSH_AUTH_SOCK
) to test.
Upvotes: 16
Reputation: 2242
Had same issue, which was related to my ssh client.
This was confirmed trying to connect to a remote ssh server with the '-v' (verbose) option
ssh -v -p PORTNUMBER USERNAME@SERVER
which gave rekey after XXXXXX blocks”
before getting stuck.
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.
Upvotes: 1
Reputation: 6836
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
.
Upvotes: 125
Reputation: 1826
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.
Upvotes: 12
Reputation: 4715
I am in Windows, and I solved the hang by closing the Visual Studio before doing the pull.
Upvotes: 11