问题
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
or git 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 "me@example.com"
asks me for a file name and hangs
git push heroku master
hangs
$ git status
returns On branch master nothing to commit, working directory clean
$ git pull
returns Already up to date
$ git remote -v
returns:
heroku git@heroku.com:myherokusite.git (fetch)
heroku git@heroku.com: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 git@github.com:gitusername/gitrepo.git
also hangs
git remote set-url origin https://github.com/gitusername/appname.git
is correct
Updated: 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
回答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.
回答2:
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.
回答3:
Try GIT_CURL_VERBOSE=1 git push ...It may happen due to proxy setting git will be trying to reach github.com via proxy server and proxy is not responding. With GIT_CURL_VERBOSE=1 will show the ip address and some information. you can compare ip address with command output "host www.github.com" ip address. if they are different then you can make https_proxy="" and try again.
回答4:
I had the same problem with absolutely same symptoms… I was about to rebuild my whole system in my despair)).
I even was so naive to try git config --global core.askpass "git-gui--askpass"
as some people suggest here, but it didn't work…
git push
was still freeze…
But then I figured out that there was an error with my SSH agent. So I've restarted ssh-agent and… PROFIT
Conclusion: Always check your SSH Agent and SSHD server when you have troubles with ssh connection… I'm pretty sure that was your problem (And that's why it worked after reinstallation of your system)
回答5:
Its worth checking if you are using the cygwin git or an external git (ie github).
If whereis git
returns just /cygdrive/c/Program Files (x86)/Git/cmd/git.exe
or similar its best to install the cygwin git package, this solved the problem for me.
回答6:
Try the following;
git config --global core.askpass "git-gui--askpass"
This will prompt for credentials and then "push" succeeds if credentials are correct.
回答7:
I thought my Git windows screen was struck but actually a sign in prompt comes behind it.Check for it and enter your credentials and that's it.
回答8:
I just wanted to say that I'm having this issue on my AWS EC2 instances. I was trying to push from my EC2 instance itself, when I have it configured to only allow traffic in from the load balancer. I changed the rule to allow HTTP in from everywhere, but it still didn't fix the problem. Then I realized it's because my security groups are configured to not allow outbound traffic from my EC2 instances over HTTPS. I didn't have allow HTTPS inbound traffic to make it work, even though it's probably a good policy for you to have HTTPS available inbound.
回答9:
This occurred for me when my computer's disk space was full. Delete some files & empty the trash to fix.
回答10:
In my case the issue was there was some process that had locked my keychain access...
Force quit all other apps to make sure keychain access is not locked on your Mac
回答11:
For 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
.
回答12:
I had the same issue. Stop worrying and searching endless complicated solutions, just remove git and reinstall it.
sudo apt-get purge git
sudo apt-get autoremove
sudo apt-get install git
Thats it. It should work now
回答13:
I'm wondering if it's the same thing I had...
- Go into Putty
- Click on "Default Settings" in the Saved Sessions. Click Load
- Go to Connection -> SSH -> Bugs
- Set "Chokes on PuTTY's SSH-2 'winadj' requests" to On (instead of Auto)
- Go Back to Session in the treeview (top of the list)
- Click on "Default Settings" in the Saved Sessions box. Click Save.
This (almost verbatim) comes from :
https://tortoisegit.org/issue/1880
回答14:
Will usually see myself running into this problem when pushing a large quantity of files.
If you can be patient and let the files finishing uploading, you might not need to do anything at all. Good luck –
回答15:
I also had an issue where git hangs on the "Writing objects" part on Windows 7 (using msysgit, the default windows client from git) and this is the first hit I got in google, so I will also post my answer here.
git config --global core.askpass "git-gui--askpass"
did not work unfotunately, but after some researching I found the tip on Git push halts on "Writing Objects: 100%" to use git config –global sendpack.sideband false
which worked perfectly.
I can finally push from the commandline again!
回答16:
I had two repositories, pushing to one of which worked fine. So, I compared their .git/config
. The non-working one had at the end:
[http]
sslVerify = false
The working one had instead:
[credential]
helper = store
Changing .git/config
solved the problem.
回答17:
Had the same problem. Was a little bit confused but the thing was I had make a git init --bare on root, that means that you won't be able to push because of you don't have any rights. Instead make a new User or in my case I used Pi User and made git init --bare there, which then later on it worked.
git config --global http.postBuffer 524288000
Maximum size in bytes of the buffer used by smart HTTP transports when POSTing data to the remote system. For requests larger than this buffer size, HTTP/1.1 and Transfer-Encoding: chunked is used to avoid creating a massive pack file locally. Default is 1 MiB, which is sufficient for most requests.
回答18:
Restart your ssh agent!
killall ssh-agent; eval `ssh-agent`
回答19:
This occurred for me, here is how I fixed. I used Cygwin and it hanged so I tried prompting for username/password on commit :
git config --global core.askpass "git-gui--askpass"
Once I executed git push -u origin master
and entered username password, it still did hang but appeared to commit to GitHub.
Used same command from dos prompt : git push -u origin master
Git does not hang. So perhaps issue related to CygWin in my case.
来源:https://stackoverflow.com/questions/16906161/git-push-hangs-when-pushing-to-github