推送到 Github 时 Git 推送挂起?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16906161/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git push hangs when pushing to Github?
提问by Matt Singer
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.
每次我尝试推送到 github 时,Git push 都会挂起。我正在使用 Cygwin 和 Windows 7。Git 可以很好地在本地跟踪分支、提供状态、设置全局 user.name 和 user.email 并允许提交。
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.
我输入git push
,git push origin master
或者git push -u origin master
,我只得到一个空行,要求我按 ctl-c 来获取提示。
ssh-keygen -t rsa -C "[email protected]"
asks me for a file name and hangs
ssh-keygen -t rsa -C "[email protected]"
向我询问文件名并挂起
git push heroku master
hangs
git push heroku master
挂起
$ git status
returns On branch master nothing to commit, working directory clean
$ git status
返回 On branch master nothing to commit, working directory clean
$ git pull
returns Already up to date
$ git pull
返回 Already up to date
$ git remote -v
returns:
$ git remote -v
返回:
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 hangs
更新:使用 SSH url[email protected]:gitusername/gitrepo.git
也会挂起
git remote set-url origin https://github.com/gitusername/appname.git
is correct
git remote set-url origin https://github.com/gitusername/appname.git
是正确的
Updated:I can see the git processes running in Windows Task Manager while it hangs.
更新:当它挂起时,我可以看到在 Windows 任务管理器中运行的 git 进程。
I've tried:
我试过了:
Using different internet connection locations
使用不同的互联网连接位置
switching between https and ssh and it hangs
在 https 和 ssh 之间切换并挂起
Uninstalled git. Reinstalled from: https://code.google.com/p/msysgit/downloads/list
卸载了 git。重新安装:https: //code.google.com/p/msysgit/downloads/list
Uninstalled git. Installed Cygwin's git
卸载了 git。安装 Cygwin 的 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.
卸载了 git。为 Windows GUI 应用程序安装了 Github,我可以推送它。但是这个应用程序的功能有限,迫使我离开我的 Cygwin 窗口进入另一个应用程序,然后强迫我进入 Windows 命令提示符以获得完整的功能,我认为我已经通过使用 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
更新 4/2014:我重建了我的整个机器 Win 7、Cygwin 等,现在一切正常
回答by forloop
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.
这对我有用。提示出现可能需要 3-5 秒,只需输入您的登录凭据,您就可以开始了。
回答by Matt Montag
Try creating a script like ~/sshv.sh
that will show you what ssh is up to:
尝试创建一个这样的脚本~/sshv.sh
,它将向您展示 ssh 的作用:
#!/bin/bash
ssh -vvv "$@"
Allow execution of the ~/sshv.sh
file for the owner of the file:
允许为~/sshv.sh
文件所有者执行文件:
chmod u+x ~/sshv.sh
Then invoke your git push
with:
然后调用你git push
的:
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.
就我而言,这帮助我弄清楚我正在使用需要关闭的 ssh 共享连接,所以我杀死了那些 ssh 进程并开始工作。
回答by Guruswamy Basavaiah
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.
尝试 GIT_CURL_VERBOSE=1 git push ...这可能是由于代理设置 git 将尝试通过代理服务器访问 github.com 而代理没有响应。使用 GIT_CURL_VERBOSE=1 将显示 IP 地址和一些信息。您可以将 ip 地址与命令输出“host www.github.com”ip 地址进行比较。如果它们不同,那么您可以创建 https_proxy="" 并重试。
回答by Drew
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…
我什至太天真了,git config --global core.askpass "git-gui--askpass"
像这里的一些人建议的那样尝试,但它没有用……
git push
仍然冻结……
But then I figured out that there was an error with my SSH agent. So I've restarted ssh-agent and… PROFIT
但后来我发现我的 SSH 代理有错误。所以我重新启动了 ssh-agent 并且......
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)
结论:当您遇到 ssh 连接问题时,请务必检查您的 SSH 代理和 SSHD 服务器……我很确定这是您的问题(这就是为什么在重新安装系统后它可以工作的原因)
回答by Sam
Its worth checking if you are using the cygwin git or an external git (ie github).
如果您使用的是 cygwin git 或外部 git(即 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.
如果whereis git
返回只是/cygdrive/c/Program Files (x86)/Git/cmd/git.exe
或类似的最好安装 cygwin git 包,这为我解决了问题。
回答by Goutham Kumar BV
Try the following;
尝试以下操作;
git config --global core.askpass "git-gui--askpass"
git config --global core.askpass "git-gui--askpass"
This will prompt for credentials and then "push" succeeds if credentials are correct.
如果凭据正确,这将提示输入凭据,然后“推送”成功。
回答by Thakur Karthik
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.
我以为我的 Git 窗口屏幕被击中了,但实际上它后面出现了一个登录提示。检查它并输入您的凭据,就是这样。
回答by jdogg
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.
我只是想说我在我的 AWS EC2 实例上遇到了这个问题。当我将它配置为仅允许来自负载均衡器的流量时,我试图从我的 EC2 实例本身推送。我更改了规则以允许来自任何地方的 HTTP,但它仍然没有解决问题。然后我意识到这是因为我的安全组被配置为不允许来自我的 EC2 实例通过 HTTPS 的出站流量。我没有允许 HTTPS 入站流量使其工作,即使让 HTTPS 入站可用可能是一个很好的策略。
回答by jburtondev
Restart your ssh agent!
重新启动您的 ssh 代理!
killall ssh-agent; eval `ssh-agent`
回答by Dan
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.
- 进入腻子
- 单击“保存的会话”中的“默认设置”。点击加载
- 转到连接 -> SSH -> 错误
- 将“在 PuTTY 的 SSH-2 'winadj' 请求上阻塞”设置为开启(而不是自动)
- 在树视图中返回会话(列表顶部)
- 单击“保存的会话”框中的“默认设置”。单击保存。
This (almost verbatim) comes from :
这(几乎是逐字逐句)来自: