The remote end hung up unexpectedly while git cloning

后端 未结 30 2569
旧时难觅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:34

    This is due the internet connectivity issue, i faced the same issue. I did a shallow copy of code using

    git clone --depth 1 //FORKLOCATION
    

    Later unshallowed the clone using

    git fetch --unshallow
    
    0 讨论(0)
  • 2020-11-22 09:34

    Faced same issue, try to merge with another branch and take a pull from them. It works for me same.

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

    The http.postBuffer trick did not work for me. However:

    For others experiencing this problem, it may be an issue with GnuTLS. If you set Verbose mode, you may see the underlying error look something along the lines of the code below.

    Unfortunately, my only solution so far is to use SSH.

    I've seen a solution posted elsewhere to compile Git with OpenSSL instead of GnuTLS. There is an active bug report for the issue here.

    GIT_CURL_VERBOSE=1 git clone https://github.com/django/django.git
    
    Cloning into 'django'...
    * Couldn't find host github.com in the .netrc file; using defaults
    * About to connect() to github.com port 443 (#0)
    *   Trying 192.30.252.131... * Connected to github.com (192.30.252.131) port 443 (#0)
    * found 153 certificates in /etc/ssl/certs/ca-certificates.crt
    *    server certificate verification OK
    *    common name: github.com (matched)
    *    server certificate expiration date OK
    *    server certificate activation date OK
    *    certificate public key: RSA
    *    certificate version: #3
    *    subject: 
    *    start date: Mon, 10 Jun 2013 00:00:00 GMT
    *    expire date: Wed, 02 Sep 2015 12:00:00 GMT
    *    issuer: C=US,O=DigiCert Inc,OU=www.digicert.com,CN=DigiCert High Assurance EV CA-1
    *    compression: NULL
    *    cipher: ARCFOUR-128
    *    MAC: SHA1
    > GET /django/django.git/info/refs?service=git-upload-pack HTTP/1.1
    User-Agent: git/1.8.4
    Host: github.com
    Accept: */*
    Accept-Encoding: gzip
    
    Pragma: no-cache
    < HTTP/1.1 200 OK
    < Server: GitHub.com
    < Date: Thu, 10 Oct 2013 03:28:14 GMT
    
    < Content-Type: application/x-git-upload-pack-advertisement
    < Transfer-Encoding: chunked
    < Expires: Fri, 01 Jan 1980 00:00:00 GMT
    < Pragma: no-cache
    < Cache-Control: no-cache, max-age=0, must-revalidate
    < Vary: Accept-Encoding
    < 
    * Connection #0 to host github.com left intact
    * Couldn't find host github.com in the .netrc file; using defaults
    * About to connect() to github.com port 443 (#0)
    *   Trying 192.30.252.131... * connected
    * found 153 certificates in /etc/ssl/certs/ca-certificates.crt
    * SSL re-using session ID
    *    server certificate verification OK
    *    common name: github.com (matched)
    *    server certificate expiration date OK
    *    server certificate activation date OK
    *    certificate public key: RSA
    *    certificate version: #3
    *    subject: 
    *    start date: Mon, 10 Jun 2013 00:00:00 GMT
    *    expire date: Wed, 02 Sep 2015 12:00:00 GMT
    *    issuer: C=US,O=DigiCert Inc,OU=www.digicert.com,CN=DigiCert High Assurance EV CA-1
    *    compression: NULL
    *    cipher: ARCFOUR-128
    *    MAC: SHA1
    > POST /django/django.git/git-upload-pack HTTP/1.1
    User-Agent: git/1.8.4
    Host: github.com
    Accept-Encoding: gzip
    
    Content-Type: application/x-git-upload-pack-request
    Accept: application/x-git-upload-pack-result
    Content-Encoding: gzip
    Content-Length: 2299
    * upload completely sent off: 2299out of 2299 bytes
    
    < HTTP/1.1 200 OK
    < Server: GitHub.com
    < Date: Thu, 10 Oct 2013 03:28:15 GMT
    
    < Content-Type: application/x-git-upload-pack-result
    < Transfer-Encoding: chunked
    < Expires: Fri, 01 Jan 1980 00:00:00 GMT
    < Pragma: no-cache
    < Cache-Control: no-cache, max-age=0, must-revalidate
    < Vary: Accept-Encoding
    < 
    remote: Counting objects: 232015, done.
    remote: Compressing objects: 100% (65437/65437), done.
    * GnuTLS recv error (-9): A TLS packet with unexpected length was received.
    * Closing connection #0
    error: RPC failed; result=56, HTTP code = 200
    fatal: The remote end hung up unexpectedly
    fatal: early EOF
    fatal: index-pack failed
    
    0 讨论(0)
  • 2020-11-22 09:39

    I faced with this problem using git in Kubuntu. I've also noticed overall instability in networking and found a solution.

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

    options single-request

    This fixed delays before every domain name resolution and git started to work like a charm after this.

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

    use ssh instead of http, it's not a good answer for this question but at least it works for me

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

    For shared bandwidth try to clone when load is less. Otherwise, try with a high speed connection. If still does not work, please use below command,

    git config --global http.postBuffer 2048M
    git config --global http.maxRequestBuffer 1024M
    git config --global core.compression 9
    
    git config --global ssh.postBuffer 2048M
    git config --global ssh.maxRequestBuffer 1024M
    
    git config --global pack.windowMemory 256m 
    git config --global pack.packSizeLimit 256m
    

    And try to clone again. You might need to change those settings according to your available memory size.

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