Git push hangs when pushing to Github?
Solution 1
git config --global core.askpass "git-gui--askpass"
This worked for me. It may take 3-5 secs for the prompt to appear just enter your login credentials and you are good to go.
Solution 2
Restart your ssh agent!
killall ssh-agent; eval `ssh-agent`
Solution 3
Try creating a script like ~/sshv.sh
that will show you what ssh is up to:
#!/bin/bash
ssh -vvv "$@"
Allow execution of the ~/sshv.sh
file for the owner of the file:
chmod u+x ~/sshv.sh
Then invoke your git push
with:
GIT_SSH=~/sshv.sh git push ...
In my case, this helped me figure out that I was using ssh shared connections that needed to be closed, so I killed those ssh processes and it started working.
Solution 4
Try GIT_CURL_VERBOSE=1 git push
...Your problem may occur due to proxy settings, for instance if git is trying to reach github.com via a proxy server and the proxy is not responding.
With GIT_CURL_VERBOSE=1 it will show the target IP address and some information. You can compare this IP address with the output of the command: host www.github.com
. If these IPs are different then you can set https_proxy=""
and try again.
Solution 5
Using "Command Prompt" (cmd) instead of git bash for initial push resolved the hang up for me. Since then I use git bash without any issues.
Related videos on Youtube
Matt Singer
Entrepreneur, Marketing, Sales, Internet, Tech, Management, Business Startup & Development, Team Building Aspiring Ruby on Rails Developer, beginner, learning. Building BizRoller.com with Ruby on Rails
Updated on April 24, 2022Comments
-
Matt Singer about 2 years
Git push hangs everytime I try to push to github. I am using Cygwin and Windows 7. Git functions fine locally tracking branches, providing status, setting global user.name and user.email and allowing commits.
I'm still new and learning.
I enter
git push
,git push origin master
orgit push -u origin master
and I get nothing but a blank line requiring me to ctl-c to get the prompt back.ssh-keygen -t rsa -C "[email protected]"
asks me for a file name and hangsgit push heroku master
hangs$ git status
returnsOn branch master nothing to commit, working directory clean
$ git pull
returnsAlready up to date
$ git remote -v
returns:heroku [email protected]:myherokusite.git (fetch) heroku [email protected]:myherokusite.git (push) origin https://github.com/gitusername/appname.git (fetch) origin https://github.com/gitusername/appname.git (push) or the correct ssh remote settings are returned when trying this with ssh
Updated: Using the SSH url
[email protected]:gitusername/gitrepo.git
also hangsgit remote set-url origin https://github.com/gitusername/appname.git
is correctUpdated: I can see the git processes running in Windows Task Manager while it hangs.
I've tried:
Using different internet connection locations
switching between https and ssh and it hangs
Uninstalled git. Reinstalled from: https://code.google.com/p/msysgit/downloads/list
Uninstalled git. Installed Cygwin's git
Uninstalled git. Installed Github for Windows GUI app and it I WAS able to push. But this app has limited functionality, forces me out of my Cygwin window into another app which then forces me into a Windows command prompt for complete functionality which I thought I had escaped by using Cygwin.
Spent many, many hours trying to resolve this, it worked faultlessly before, thanks.
UPDATE 4/2014: I rebuilt my entire machine Win 7, Cygwin etc and all is now working fine
-
Guillaume Darmont almost 11 yearsAre you behind a firewall or a proxy ?
-
Matt Singer almost 11 yearsI tried different internet connections without success, yes I have anti-virus which had never caused a problem previously. No proxy.
-
skilbjo almost 11 yearsAny luck? I am encountering the same issue with cygwin. A fix: if I use the native windows shell (cmd.exe) however,
git push origin master
works fine. -
Michael Trojanek over 7 yearsFor the sake of completeness (sometimes problems like this are not as complicated as they might seem): Having a non-existing remote repository configured can also result in this behavior - I recently found out by accidentally changing my origin's URL to
githu.com
. -
ktamas over 4 yearsFor me restarting computer helped.
-
PetMarion almost 4 yearsAnother reason might be that the git server has reached its resource limits, and there's nothing wrong with your local git setup.
-
erwaman over 3 yearsWhen this happens for me, I've found deleting
~/.ssh/[email protected]:22.connection
fixes the issue (I have some settings in ~/.ssh/config to persist connections). -
42n4 about 3 yearsI had to logout from VPN.
-
-
Allan Nienhuis about 10 yearsthat was very helpful for me - Thanks!
-
hello_there_andy almost 9 yearsI ran this and now it keeps saying
error: cannot run git-gui--askpass: No such file or directory
, could you advise me on how to reverse this please? -
markphd almost 9 years@hello_there_andy this may help you.
-
Yan King Yin over 8 yearshow do you restart ssh-agent? I'm using linux
-
ashes999 over 7 yearsI restarted ssh-agent by terminating the
ssh-agent.exe
process. On windows, you can useps -ef | grep ssh
to find it, andkill
to exterminate it. Restarting is probably safer. @YanKingYin -
Drew over 7 years@Yan King Yin Nov, I'm not sure about linux, but on mac I've done it using LaunchControl GUI or running:
sudo launchctl stop /System/Library/LaunchAgents/org.openbsd.ssh-agent
andsudo launchctl start /System/Library/LaunchAgents/org.openbsd.ssh-agent
... Pretty sure linux should have something similar to bsd launchd… Like init-v or systemd way of stopping/starting agents/daemons… You could try this spell:killall ssh-agent; eval $(ssh-agent)
. Let me know if it's working for you. -
Luka Ramishvili over 6 yearsThis was the issue in my case. Fortunately, git push hanged for multiple remotes so I knew there wasn't a problem with the remote's server.
-
AlwaysLearning over 5 yearsThis line did nothing for me. Empty output.
-
Jérémie Lesage over 5 yearsFor debug, it's simpler to add
LogLevel DEBUG3
in~/.ssh/config
-
Sebasthian Ogalde about 5 yearsAfter running this line, the problem is not solved and now when pushing, git keeps saying
error: cannot run git-gui--askpass: No such file or directory
. The solution added by @forloop helped me to reverse it. -
Matteljay over 4 yearsI tried
git push -u origin master --verbose
but even that didn't show anything useful. After reading this solution I copied the whole~/.ssh
from my older Linux pc to my Windows Cygwin64 home/user folder, worked like a charm. -
EMon over 4 yearsThat's the one!
-
Albert Mosiałek about 4 yearsThank you. In my case it was enough to restart sshd:
sudo systemctl restart sshd
-
Martin DeMello almost 4 yearsthanks, just ran into this problem and it was my ssh agent hanging too! would have taken me ages to figure it out myself
-
colmjude almost 4 yearsThis worked for me too when my terminal was hanging indefinitely
-
thienkhoi tran over 3 yearsThis should be the answer, I'm using ubuntu 20 (2 years since your posted comment) and facing the same issue, I've reinstalled this and it's working now,
-
jones over 3 yearsit seems to happen again and again though :( this command helps sometimes, other times it will still halt. something's not right
-
jburtondev over 3 yearsYes that doesn't sound right. Perhaps you should put this command in your bash profile so every time you load the terminal it will run it.
-
Timo over 3 yearsAfter Adding logLevel Debug3, is ssh reload needed? I do not think so due to client side.
-
Timo over 3 years
GIT_SSH=~/sshv.sh git push ...
: Is this a GIT var and also a cmd to run/execute? Why is the var defined and not the script run with the git push param. I tested this: ssh -vvv 'git push', but no avail. -
Kushan Gunasekera over 3 yearsThis is working fine in Ubuntu 20.04, thank you @gustavz
-
stasdeep over 3 yearsThat was the issue for me, thanks a lot! After disconnecting from the VPN I've managed to push.
-
Stefan almost 3 yearsWhere is that sign in prompt?
-
Keshav Gupta almost 3 yearsI did not expect this to work! thanks for the tip
-
devnull69 over 2 yearsOh my god ... this worked. I wasn't expecting this
-
blaylockbk over 2 yearsI killed all tasks and now git push works. 🤷🏻♂️
-
jburtondev over 2 years@blaylockbk lol
-
Flip over 2 yearsWorked perfectly fine for me. I didn't even have to enter any credentials.
-
Dave Pritlove about 2 yearsThis worked for me. Terminal on Mac was hanging after listing Enumerating... Counting... Writing... Total... but this killall freed it up.
-
Jomy about 2 yearsThat's the one for me
-
user212514 about 2 yearsI ended up setting the buffer for the local repo only, but it solved my issue
git config --local http.postBuffer 524288000
-
rufatZZ about 2 yearsTHIS IS THE ONE!
-
aRyhan almost 2 years2022 and this still works!