git clone hangs on "Cloning into..." using GitBash
Asked Answered
A

5

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 [email protected]/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.

Acevedo answered 24/6, 2021 at 16:30 Comment(4)
How large is the repo you're trying to clone?Brno
Very small. It's one text file with two lines in it.Acevedo
what is the version of git-for-windows?Tourney
2.32.0.windows.1Acevedo
D
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.

Dennison answered 11/7, 2021 at 9:16 Comment(1)
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!!Zr
D
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.

Diablerie answered 18/12, 2021 at 18:49 Comment(0)
R
0

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.

Redistrict answered 18/8, 2022 at 18:15 Comment(0)
W
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
Wilser answered 21/8, 2023 at 21:52 Comment(0)
U
0

My problem is the uses of the company's network that prevent me from connecting the github server I think. To solve this problem, I connect the computer to my private network.

Uribe answered 20/9 at 10:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.