git clone hangs forever on github

2019-01-19 09:33发布

问题:

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 git@github.com

debug1: Authentication succeeded (publickey).
Authenticated to github.com ([207.97.227.239]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
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

回答1:

GitHub offers a few different ways to connect to the remote repo. I am behind an onerous firewall. All methods also hang except using http (not https).

For example, the JavaHamcrest project offers (anonymously):

  • https://github.com/hamcrest/JavaHamcrest.git
  • git@github.com:hamcrest/JavaHamcrest.git
  • git://github.com/hamcrest/JavaHamcrest.git

You may also try:

  • http://github.com/hamcrest/JavaHamcrest.git

Finally, prefix your UNIX command with GIT_TRACE=1 and GIT_CURL_VERBOSE=1, and use Git option --verbose for maximum debug output.

Example: GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone --verbose http://github.com/hamcrest/JavaHamcrest.git



回答2:

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.

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.



回答3:

Try using HTTPS instead of SSH. Port 22 might be blocked by a firewall.

E.g. instead of:

git clone git@bitbucket.org:repo-owner/my-project.git

Connect via HTTPS:

git clone https://username@bitbucket.org/repo-owner/my-project.git


回答4:

I had the same issue on Xubuntu. Doing ssh -Tv git@github.com hangs forever. Disabling the firewall with sudo ufw disable solved the problem.



回答5:

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 git@github.com" command worked. I was also able to clone a repository and push my code from local to Github.



回答6:

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

git clone https://cchamberlain@github.com/cchamberlain/<repo>

and it worked. Not sure if its a one-off yet.



标签: git ssh github