The remote end hung up unexpectedly while git cloning

后端 未结 30 2567
旧时难觅i
旧时难觅i 2020-11-22 09:02

My git client repeatedly fails with the following error after trying to clone the repository for some time.

What could be the issue here?

相关标签:
30条回答
  • 2020-11-22 09:24

    in /etc/resolv.conf add the line to the end of the file

    options single-request
    
    0 讨论(0)
  • 2020-11-22 09:25

    Based on this answer, I tried following (with https url):

    1. initial cloning of repo:

    git clone --depth 25 url-here

    1. fetch commits with increasing twice per try depth:

    git fetch --depth 50

    git fetch --depth 100

    git fetch --depth 200

    ...and so on

    1. eventually (when I think enough is fetched) I run git fetch --unshallow - and it's done.

    The process obviously takes much more time, but in my case setting http.postBuffer and core.compression didn't help.

    UPD: I found out that fetching via ssh works for any repo size (discovered accidentally), done with git clone <ssh url>, given you have created ssh keys. Once repo is fetched, I change remote address using git remote set-url <https url to repo>

    0 讨论(0)
  • 2020-11-22 09:25

    I have the same error while using BitBucket. What I did was remove https from the URL of my repo and set the URL using HTTP.

    git remote set-url origin http://mj@bitbucket.org/mj/pt.git
    
    0 讨论(0)
  • 2020-11-22 09:25

    I found my problem to be with the .netrc file, if so for you too then you can do the following:

    Open your .netrc file and edit it to include github credentials. Type nano ~/netrc or gedit ~/netrc

    Then include the following: *machine github.com

    login username

    password SECRET

    machine api.github.com

    login username

    password SECRET*

    You can include your raw password there but for security purposes, generate an auth token here github token and paste it in place of your password.

    Hope this helps someone

    0 讨论(0)
  • 2020-11-22 09:27

    The only thing that worked for me was to clone the repo using the HTTPS link instead of the SSH link.

    0 讨论(0)
  • 2020-11-22 09:30

    It may be as simple as a server problem. If using GitHub, check https://twitter.com/githubstatus. I saw this for the first time just now and discovered GitHub's having a wobble. A few minutes later it worked again fine.

    0 讨论(0)
提交回复
热议问题