git clone hangs on "Cloning into..." using GitBash

Viewed 6526

I'm trying to clone a repository from my organization's GitHub using GitBash, but when I do a git clone, it hangs indefinitely. The output is as follows:

git clone https://github.com/myorganization/myrepository
Cloning into 'myrepository'...

I have looked at other stackoverflow pages. git clone hangs forever on github suggests trying to cone using git clone git@github.com/myorganization/myrepository, which didn't work. It also suggests doing GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone --verbose https://github.com/myorganization/myrepository. When I do that, I notice that it's hanging at:

[...]
11:44:04.432276 http.c:721              <= Recv header, 0000000057 bytes (0x00000039)
11:44:04.432276 http.c:733              <= Recv header: x-github-request-id: CEEF:07BD:11FD966:1D089D5:60D380F4
11:44:04.432276 http.c:721              <= Recv header, 0000000023 bytes (0x00000017)
11:44:04.432276 http.c:733              <= Recv header: x-frame-options: DENY
11:44:04.432276 http.c:721              <= Recv header, 0000000002 bytes (0x00000002)
11:44:04.432276 http.c:733              <= Recv header:
11:44:04.432276 http.c:774              == Info: Connection #0 to host github.com left intact

(I can show the whole output if necessary.)

I've also looked at Git clone, push and pull all hang with no messages, which suggests that it may be a network issue. To diagnose the network issue, I installed GitHub Desktop, and tried the clone, which works fine. Therefore, it's not a network issue.

I've tried some other things too:

  • I confirmed that I have access to my GitHub repository (I'm listed as a member in the repo)
  • I've reset my username and email using git config --global user.name[email] to something random to trigger a login for the repo. (A login never came.)
  • I've re-installed GitBash following this guide.
  • I've also tried (un)setting http/https proxies with git config --global --unset http.proxy and git config --global --unset https.proxy

If someone could help me solve this problem, I'd appreciate it. Thank-you.

3 Answers

If you have enabled ssh for your account then it is due to same reason. I also faced it and with below command you can easily avoid hang problem during clone.

  • ssh -T git@github.com (This command will authenticate you over ssh)
  • git clone git@github.com:[user]/[repo]

The issue for me when I ran into this was that it was a private repo and I accidentally used the HTTPS URL instead of the SSH url, and so it was hanging on the missing the credentials. Since I already has SSH keys setup locally and in GitHub, I just switched over to the SSH url.

Related