git克隆时,远端意外挂断

尝试克隆存储库一段时间后,我的git客户端反复失败,并出现以下错误。

这里可能是什么问题?

注意:我已经通过GIT托管服务提供商注册了我的SSH密钥

Receiving objects:  13% (1309/10065), 796.00 KiB | 6 KiB/s
fatal: The remote end hung up unexpectedly

快速解决:

有了这种错误,我通常通过以下方式来提高postBuffer大小:

git config --global http.postBuffer 524288000

(下面的一些评论报告必须将价值翻倍):

git config --global http.postBuffer 1048576000

更多信息:

git config手册页, http.postBuffer是关于:

将数据发布到远程系统时,智能HTTP传输所使用的缓冲区的最大大小(以字节为单位)。
对于大于此缓冲区大小的请求,使用HTTP / 1.1和Transfer-Encoding: chunked来避免在本地创建大量的包文件。 默认值是1 MiB,这对大多数请求来说已经足够了。

即使对于克隆,也可以产生效果,在这种情况下,OP Joe报告:

[克隆]现在工作正常


注意:如果服务器端出现问题,并且服务器使用Git 2.5+(Q2 2015),则错误消息可能更加明确。
请参阅“Git克隆:远程终端意外挂断,尝试更改postBuffer但仍然失败”。


古来(在评论中)指出这个Atlassian疑难解答Git页面,它增加了:

Error code 56表示卷曲接收错误CURLE_RECV_ERROR ,这意味着有一些问题阻止了在克隆过程中接收数据。
通常,这是由于网络设置,防火墙,VPN客户端或反病毒软件在所有数据传输完毕之前都会终止连接。

它还提到了以下环境变量,以帮助调试过程。

# Linux
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1

#Windows
set GIT_TRACE_PACKET=1
set GIT_TRACE=1
set GIT_CURL_VERBOSE=1

http.postBuffer技巧对我不起作用。 然而:

对于遇到此问题的其他人,这可能是GnuTLS的一个问题。 如果您设置了详细模式,您可能会看到底层错误是沿着下面的代码行的。

不幸的是,我目前唯一的解决方案是使用SSH。

我看到了其他地方发布的解决方案,用OpenSSL而不是GnuTLS来编译Git。 这里有一个关于这个问题的活跃的错误报告。

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

以上都没有为我工作,但这是什么:https://stackoverflow.com/a/22317479

我收到的完整错误信息是:

fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
链接地址: http://www.djcxy.com/p/27073.html

上一篇: The remote end hung up unexpectedly while git cloning

下一篇: How do I clone a subdirectory only of a Git repository?