git clone 永远挂在 github 上
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8750930/
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 clone hangs forever on github
提问by rvange
When I follow point 5 (Test everything out) in the github guide, the ssh command also hangs forever. According to the guide, I should be presented with a message that "Github does not provide shell access". Below is my output from ssh -vT [email protected]
当我按照 github指南中的第 5 点(测试所有内容)进行操作时,ssh 命令也会永远挂起。根据指南,我应该看到一条消息“Github 不提供 shell 访问”。下面是我从 ssh -vT [email protected] 的输出
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([207.97.227.239]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LC_MESSAGES = en_US.UTF-8
debug1: Sending env LC_COLLATE = en_US.UTF-8
debug1: Sending env LANG = da_DK.UTF-8
debug1: Sending env LC_CTYPE = en_US.UTF-8
采纳答案by rvange
I think I found the error. The WiMAX router I am using, messes SSH up. After trying another internet connection, it went smooth. The WiMAX router is branded "Alvarion", and according to a Danish Google Group the NAT implementation is broken in the router: http://groups.google.com/group/openspaceaarhus/browse_thread/thread/e99d96122a0522b7.
我想我发现了错误。我正在使用的 WiMAX 路由器搞乱了 SSH。尝试另一个互联网连接后,它变得顺利。WiMAX 路由器的品牌是“Alvarion”,根据丹麦谷歌集团的说法,路由器中的 NAT 实现被破坏:http: //groups.google.com/group/openspaceaarhus/browse_thread/thread/e99d96122a0522b7。
I have contacted the internet supplier to look into this. If they prove it has nothing to do with their router I will post it here.
我已经联系了互联网供应商来调查这个问题。如果他们证明这与他们的路由器无关,我会在这里发布。
Thank you all for your comments, which made me realise it maybe was an infrastructure problem.
感谢大家的评论,这让我意识到这可能是基础设施问题。
回答by kevinarpe
GitHub offers a few different ways to connect to the remote repo. I am behind an onerous firewall. All methods also hang exceptusing http (nothttps).
GitHub 提供了几种不同的方式来连接到远程存储库。我在一个繁重的防火墙后面。除了使用 http(不是https)之外,所有方法也会挂起。
For example, the JavaHamcrest project offers (anonymously):
例如,JavaHamcrest 项目提供(匿名):
- https://github.com/hamcrest/JavaHamcrest.git
- [email protected]:hamcrest/JavaHamcrest.git
- git://github.com/hamcrest/JavaHamcrest.git
- https://github.com/hamcrest/JavaHamcrest.git
- [email protected]:hamcrest/JavaHamcrest.git
- git://github.com/hamcrest/JavaHamcrest.git
You may also try:
您也可以尝试:
Finally, prefix your UNIX command with GIT_TRACE=1
and GIT_CURL_VERBOSE=1
, and use Git option --verbose
for maximum debug output.
最后,在您的 UNIX 命令前加上GIT_TRACE=1
and GIT_CURL_VERBOSE=1
,并使用 Git 选项--verbose
以获得最大的调试输出。
Example: GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone --verbose http://github.com/hamcrest/JavaHamcrest.git
例子: GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone --verbose http://github.com/hamcrest/JavaHamcrest.git
回答by chribsen
Try using HTTPS instead of SSH. Port 22 might be blocked by a firewall.
尝试使用 HTTPS 而不是 SSH。端口 22 可能被防火墙阻止。
E.g. instead of:
例如,而不是:
git clone [email protected]:repo-owner/my-project.git
Connect via HTTPS
:
连接方式HTTPS
:
git clone https://[email protected]/repo-owner/my-project.git
回答by Homam Bahrani
In my case port 22 was being blocked by a firewall, cloning via https
may not work if you have 2-factor authentication enabled. Instead edit your .ssh config to use another port. In your terminal:
在我的情况下,端口 22 被防火墙阻止,https
如果启用了 2 因素身份验证,则克隆 via可能不起作用。而是编辑您的 .ssh 配置以使用另一个端口。在您的终端中:
nano ~/.ssh/config
then add this:
然后添加这个:
Host github.com
Hostname ssh.github.com
Port 443
回答by WilderField
Make sure that you have ssh installed.
确保您已安装 ssh。
Ubuntu: sudo apt-get install ssh
Ubuntu: sudo apt-get install ssh
回答by cchamberlain
Was having the same issue on Windows / msys2. Seems to be something with the router. I pinged github.com and then cloned using my username
在 Windows / msys2 上有同样的问题。路由器好像有问题。我 ping github.com 然后使用我的用户名克隆
git clone https://[email protected]/cchamberlain/<repo>
git clone https://[email protected]/cchamberlain/<repo>
and it worked. Not sure if its a one-off yet.
它奏效了。不确定它是否是一次性的。
回答by Christian Rodemeyer
I had the same issue on Xubuntu. Doing ssh -Tv [email protected]
hangs forever. Disabling the firewall with sudo ufw disable
solved the problem.
我在 Xubuntu 上遇到了同样的问题。做ssh -Tv [email protected]
永远挂起。禁用防火墙sudo ufw disable
解决了问题。
回答by Arif Shaikh
In my case I found that my Anti-Virus was blocking access to Github. The popup appeared behind all my windows which I did not realize earlier. The moment I allowed access to GitHub "ssh -vT [email protected]" command worked. I was also able to clone a repository and push my code from local to Github.
就我而言,我发现我的反病毒软件阻止了对 Github 的访问。弹出窗口出现在我之前没有意识到的所有窗口后面。我允许访问 GitHub 的那一刻“ssh -vT [email protected]”命令起作用了。我还能够克隆一个存储库并将我的代码从本地推送到 Github。