我的git客户端在尝试克隆存储库一段时间后反复失败,出现以下错误。
这里的问题是什么?
注意:我已经向GIT托管提供商注册了我的SSH密钥
Receiving objects: 13% (1309/10065), 796.00 KiB | 6 KiB/s
fatal: The remote end hung up unexpectedly
我的git客户端在尝试克隆存储库一段时间后反复失败,出现以下错误。
这里的问题是什么?
注意:我已经向GIT托管提供商注册了我的SSH密钥
Receiving objects: 13% (1309/10065), 796.00 KiB | 6 KiB/s
fatal: The remote end hung up unexpectedly
当前回答
奥林匹克广播服务公司。:修改http。postBuffer可能还需要设置Nginx配置文件,让gitlab通过调优client_max_body_size的值来接受更大的客户端尺寸。
然而,如果你可以访问Gitlab机器或其网络中的机器,就有一个解决方案,那就是使用git bundle。
转到源计算机上的git存储库 运行git bundle create my-repo。包——所有 (如转移。, rsync) my-repo。绑定文件到目标计算机 在目标机器上,运行git clone my-repo.bundle Git远程地址:path/to/your/repo.git git推
祝你一切顺利!
其他回答
在/etc/resolv.conf中,将这一行添加到文件的末尾
options single-request
http。postBuffer的把戏对我没用。然而:
对于遇到此问题的其他人,这可能是GnuTLS的问题。如果您设置了Verbose模式,您可能会看到下面代码行所示的基本错误。
不幸的是,到目前为止我唯一的解决方案是使用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
当我从由elastic beanstalk管理的AWS EC2实例上托管的远程git repo克隆数据(通过HTTP)时,我就遇到了这个问题。 克隆本身也是在AWS EC2实例上完成的。
我尝试了上述所有的解决方案以及它们的组合:
setting git's http.postBuffer settinghttp.maxrequestbuffer turning off git compression and trying "shallow" git clone and then git fetch --unshallow - see fatal: early EOF fatal: index-pack failed tunning GIT memory settings - packedGitLimit et al, see here: fatal: early EOF fatal: index-pack failed tunning nginx configuration - setting client_max_body_size to both big value and 0 (unlimited); setting proxy_request_buffering off; setting options single-request in /etc/resolv.conf throttling git client throughput with trickle using strace for tracing git clone considering update of git client
在所有这些之后,我仍然一次又一次地面临同样的问题,直到我发现这个问题是在弹性负载均衡器(ELB)切断连接。 在直接访问EC2实例(一个托管git repo)而不是通过ELB之后,我终于成功克隆了git repo! 我仍然不确定是哪个ELB(超时)参数导致了这一点,所以我仍然需要做一些研究。
更新
改变AWS弹性负载均衡器的连接耗尽策略,将超时时间从20秒提高到300秒,似乎为我们解决了这个问题。
git克隆错误和“连接耗尽”之间的关系很奇怪,对我们来说并不明显。可能是连接耗尽超时更改导致ELB配置中的一些内部更改,从而修复了过早关闭连接的问题。
这是AWS论坛上的相关问题(还没有答案):https://forums.aws.amazon.com/thread.jspa?threadID=258572
将克隆屏幕中的源树高级选项的深度更改为25对我来说很有效
增加postBuffer大小和maxRequestBuffer将有助于解决这个问题。按照步骤做就可以了。
步骤:
1 .打开终端或Git Bash,用“cd”转到你想克隆repo的位置。
2.将压缩设置为0
git config --global core.compression 0
3.设置postBuffer大小
git config --global http.postBuffer 1048576000
4.设置maxRequestBuffer大小
git config --global http.maxRequestBuffer 100M
5.现在开始克隆
git clone <repo url>
6.等待克隆完成。
谢谢你!快乐编码!!