git clone hangs forever on github

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:

nano ~/.ssh/config

then add this:

Host github.com
  Hostname ssh.github.com
  Port 443

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.


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
  • [email protected]: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: env GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone --verbose http://github.com/hamcrest/JavaHamcrest.git


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

E.g. instead of:

git clone [email protected]:repo-owner/my-project.git

Connect via HTTPS:

git clone https://[email protected]/repo-owner/my-project.git

Tags:

Git

Ssh

Github