首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >远程端在git克隆时意外挂断

远程端在git克隆时意外挂断
EN

Stack Overflow用户
提问于 2011-07-27 18:12:14
回答 40查看 466.6K关注 0票数 352

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

这里的问题可能是什么?

注意:我已经向GIT主机提供商注册了我的SSH密钥。

代码语言:javascript
复制
Receiving objects:  13% (1309/10065), 796.00 KiB | 6 KiB/s
fatal: The remote end hung up unexpectedly
EN

回答 40

Stack Overflow用户

发布于 2017-07-15 18:29:25

Bitbucket也有同样的错误。修复方式

代码语言:javascript
复制
git config --global http.postBuffer 500M
git config --global http.maxRequestBuffer 100M
git config --global core.compression 0
票数 59
EN

Stack Overflow用户

发布于 2013-10-10 11:53:19

http.postBuffer的把戏对我不起作用。但是:

对于其他遇到这个问题的人来说,这可能是GnuTLS的问题。如果您设置了详细模式,您可能会看到与以下代码行类似的潜在错误。

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

我见过一个用OpenSSL而不是GnuTLS编译elsewhere的解决方案。对于issue here,有一个活动的错误报告。

代码语言:javascript
复制
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
票数 18
EN

Stack Overflow用户

发布于 2019-06-24 23:29:45

基于this answer,我尝试了以下内容(使用https url):

存储库的

  1. 初始克隆:

git clone --depth 25 url-here

每次尝试深度增加两次的

  1. fetch提交:

git fetch --depth 50

git fetch --depth 100

git fetch --depth 200

...and等

  1. 最终(当我认为获取到足够的数据时),我运行git fetch --unshallow --然后就完成了。

这个过程显然需要更多的时间,但在我的例子中,设置http.postBuffercore.compression并没有帮助。

更新:我发现通过 ssh 获取数据适用于任何存储库大小(偶然发现),使用git clone <ssh url>完成,假设您已经创建了ssh密钥。获取存储库后,我使用git remote set-url <https url to repo>更改远程地址

票数 12
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6842687

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档