简体   繁体   中英

Git push hangs when pushing to Github?

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 inte.net 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

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.

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.

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.

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)

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.

重新启动您的 ssh 代理!

killall ssh-agent; eval `ssh-agent`

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.

Try the following;

git config --global core.askpass "git-gui--askpass"

This will prompt for credentials and then "push" succeeds if credentials are correct.

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

我以为我的 Git Windows 屏幕被击中了,但实际上它后面出现了一个登录提示。检查它并输入您的凭据,就是这样。

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.

In may case new public key on cPanel (my remote) was not yet authorized. My client was a new machine running Ubuntu 2020-04

git push origin

...worked, but prompted for the cPanel password.

I assume the git-gui process hung waiting for a password that I couldn't enter.

After authorizing my new key git-gui worked. It did prompt for the key store password.

I'm wondering if it's the same thing I had...

  1. Go into Putty
  2. Click on "Default Settings" in the Saved Sessions. Click Load
  3. Go to Connection -> SSH -> Bugs
  4. Set "Chokes on PuTTY's SSH-2 'winadj' requests" to On (instead of Auto)
  5. Go Back to Session in the treeview (top of the list)
  6. Click on "Default Settings" in the Saved Sessions box. Click Save.

This (almost verbatim) comes from :

https://tortoisegit.org/issue/1880

This occurred for me when my computer's disk space was full. Delete some files & empty the trash to fix.

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

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 .

So when you type & enter git pish-u origin , GUI asking for your credentials should popup. In my case, after typing git pish-u origin , nothing happens until took a look at my task manager and found something running which I was certain was the GUI that should popup to ask your credentials. I decided to end its task. I was assuming that it will show an error on my gitbash but instead, the damn GUI finally showed up and I was able to finally progress.

I'm new to this. I managed to solve my issue regarding the hanging git push command.

I recently installed git scm. In one of the installation options, I had selected to use git credential manager core. I assumed that it was installed automatically. But it looks like there was an error in that installation. I reinstalled git credential manager core from the website , and it works perfectly now.

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!

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.

  1. 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.

  2. 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.

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

I spent hours trying to fix this and none of the recommendations worked. Out of frustration I moved the whole project to a backup folder, recloned a fresh and then copied over my files from backup folder. It worked!!. I suspect my issue was I committed node_module which was not excluded in .gitignore initially and removing from cache did not help/work. When I started from fresh the file size was a fraction compared to the earlier one.

This probably works for other Windows setups (I faced the issue on Windows 7 Pro 32 bits BTW and trying to push to Bitbucket, not Github).

I tried reinstalling Git and fiddling with the installer configuration.

Got it working with the OpenSSH setting left out and choosing Not to use one when choosing a credentials manager, which is probably what the SSH agent explained in other answers is called on GNU/Linux, so the hanging was probably due to waiting for an assumingly unavailable Windows credentials manager to respond.

I was faced with the same problem.
I use Github desktop for the normal action and it can push or pull, but it doesn't support force push, when I try to do some rebase work and it always failed to push force.
I tried add core.askpass , config the proxy but all not work. Finally I decided to watch the log of Github desktop and I found it use below command to push:

git -c credential.helper= -c protocol.version=2 push origin

I tried this one with force flag and it work, it finally ask me for the user name and password.
I am not sure which configuration make it work, but I think this may help.

EDIT: I tried to install manager-core from here and I am able to push. It seems like manager-core is not installed properly.

Use Git CMD, not Cygwin Bash Terminal.

By using the Git CMD, my system was able to authenticate my information on GitHub. After that, using bash worked fine. I understand that there was some sort of authentication the program was trying to do, but couldn't do from the bash terminal for some reason. Although this answer is not comprehensive, it does get the job done.

For anyone experiencing this since 2021/08/13 and finding this question, it may be related to the recent auth policy changes on GitHub. They are no longer accepting username/password for authentication.

The solution is to set up ssh access or create a personal access token .

If you use windows credential manager, use CMD instead of git Bash . Then you can add an authentication method to proceed. This worked for me.

In my case, the issue was the https seems to be no longer supported and I had to switch all my origins from the old https://github.com/username/myrepoto git@github.com:username/myrepo.git.

I did this with git remote set-url origin git@github.com:username/myrepo.git

git config --global core.askpass "git-gui--askpass"

试试这个

我今天遇到了同样的问题,我所做的就是解决它是 remove origin git remote remove origin并重新添加它git remote add origin https://github.com/username/project.git然后我能够成功推送。

Sometimes I have this hanging issue when pushing a new branch from Android Studio and it does not give an error message. Usually, if I do a simple fetch from the master it will then work.

In my case git was trying to use Ipv6 instead of Ipv4 to authenticate github and my terminal was stuck here set_sock_tos: set socket 3 IPV6_TCLASS 0x48 .

To solve this I added AddressFamily option to ~/.ssh/config

Host github.com
  Hostname github.com
  AddressFamily inet 
  IdentityFile ~/.ssh/id_rsa  

test command:

ssh -vT git@github.com

I experienced this in andorid studio.
Actually, on git push, the progress bar kept running and nothing happened;
I used to push code using token;

Here is what i did:

  1. in android studio opened terminal.
  2. entered
git push
  1. when email and password were asked on gui, i closed the dialogue box.
  2. after that i was prompted for user name on terminal, so i did it.
  3. after that i was asked password, where instead of password, i entered the access token.
git push
Logon failed, use ctrl+c to cancel basic credential prompt.
Username for 'https://github.com': abcxyz
Password for 'https://abcxyz@github.com': ____

and voila.

If you are in VSCode it may also be the case that the GitHub VSCode extension wants to open GitHub to sign in.

If you click to fast you that popup and then all successive git push will get stuck even when you execute them from the VSCode terminal.

Solution: Close VSCode, open the project root again in a fresh window. When prompted follow the link and sign in. That's it.

Turning off Virgin Media WebSafe fixed this issue for me. Assume other ISPs have similar toggle-able safety features.

For me none of above worked. I tried this one and it worked:

git push --set-upstream origin main

Sometimes not stuck. Maybe it will be pushing. You can check progress of your push by using this command. I think this will useful for someone.

git push --progress

See more about how to see git push progress: How can I know how much percentage of git push is complete?

I was struggling with this problem on a Mac. My solution was to kill all git processes using the following command:

killall git

Hope this helps someone!

git push --all origin 

Seems to work on the M2 MacBook Pro, (Common issue for the silicon chips to freeze during the push. It happened a couple of times)

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

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

另一个原因可能是 git 服务器已达到其资源限制,并且您本地的 git 设置没有任何问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM