git clone hangs forever on github
GitSshGithubGit Problem Overview
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]
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
Git Solutions
Solution 1 - Git
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:
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
Solution 2 - Git
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
Solution 3 - 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
Solution 4 - Git
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.
Solution 5 - Git
Make sure that you have ssh installed.
Ubuntu: sudo apt-get install ssh
Solution 6 - Git
I had the same issue on Xubuntu. Doing ssh -Tv [email protected]
hangs forever. Disabling the firewall with sudo ufw disable
solved the problem.
Solution 7 - Git
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://[email protected]/cchamberlain/<repo>
and it worked. Not sure if its a one-off yet.
Solution 8 - Git
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.
Solution 9 - Git
Things to check when git clone and git push hang forever no error message
- you already have SSH keys configured for you github account - also check that you github account has ssh keys - https://inchoo.net/dev-talk/how-to-generate-ssh-keys-for-git-authorization/
- your firewall/antivirus is not blocking your traffic
Solution 10 - Git
In my case was IPV6 blocking cloning, I disable ipv6 on ssh and works
Solution 11 - Git
Mine dumb case was that, I changed default SSH port in /etc/ssh/ssh_config
instead of /etc/ssh/sshd_config
Solution 12 - Git
in my case my /etc/resolv.conf
was messed up, i noticed pc would fail to even ping google.com
. Fixed that that and life was grand.
Solution 13 - Git
I was just struggling with that (after updating to using API Token instead of password, changes on github since July'21)
What helped me was to use http instead of https in git clone.
Simple as that.