8

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.

pvasudev16
  • 83
  • 1
  • 1
  • 5

4 Answers4

12

this helped me: https://github.com/microsoft/Git-Credential-Manager-Core/issues/364 Basically, I just had to put this command git config --global credential.provider generic and then clone.

Hope it works for you as well.

Luis
  • 136
  • 1
  • 2
  • Great! the command `git config --global credential.provider generic` definitely works! After running it in GitBash appeared the window of credential helper to put user and password which didn't open automatically before. Thanks!! – Elias Nov 23 '21 at 07:56
2

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]
shaILU
  • 2,050
  • 3
  • 21
  • 40
0

I had this problem because port 22 was blocked by my firewall. Make sure to open that port. For example with ufw:

ufw allow out ssh
Mike
  • 23,542
  • 14
  • 76
  • 87
-1

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.

Cam Sloan
  • 64
  • 1
  • 4