git尝试克隆存储库一段时间后,我的客户端一再失败并出现以下错误.
这可能是什么问题?
注意:我已经向GIT托管服务提供商注册了我的SSH密钥
Receiving objects: 13% (1309/10065), 796.00 KiB | 6 KiB/s
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)
Von*_*onC 426
有了这种错误,我通常首先提高postBuffer尺寸:
git config --global http.postBuffer 524288000
Run Code Online (Sandbox Code Playgroud)
(以下一些评论报告不得不加倍价值):
git config --global http.postBuffer 1048576000
Run Code Online (Sandbox Code Playgroud)
从git config手册页,http.postBuffer是关于:
将数据发送到远程系统时,智能HTTP传输使用的缓冲区的最大大小(以字节为单位).
对于大于此缓冲区大小的请求,HTTP/1.1Transfer-Encoding: chunked用于避免在本地创建大量包文件.默认值为1 MiB,足以满足大多数请求.
即使是克隆,也会产生影响,在这种情况下,OP Joe会报告:
[克隆]现在工作正常
注意:如果服务器端出现问题,并且服务器使用Git 2.5+(2015年第2季度),则错误消息可能更明确.
请参阅" Git克隆:远程端意外挂断,尝试更改postBuffer但仍然失败 ".
Kulai(在评论中)指出这个Atlassian Troubleshooting 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
Run Code Online (Sandbox Code Playgroud)
wiz*_*awu 18
与Bitbucket相同的错误.固定的
git config --global http.postBuffer 500M
git config --global http.maxRequestBuffer 100M
git config --global core.compression 0
Run Code Online (Sandbox Code Playgroud)
Kur*_*tis 17
该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
Run Code Online (Sandbox Code Playgroud)
Анд*_*пин 12
基于这个答案,我尝试了以下(使用 https url):
git clone --depth 25 url-here
git fetch --depth 50
git fetch --depth 100
git fetch --depth 200
...等等
git fetch --unshallow- 并且完成了。这个过程显然需要更多的时间,但在我的情况下设置http.postBuffer并core.compression没有帮助。
UPD:我发现通过ssh获取适用于任何存储库大小(意外发现),使用 完成git clone <ssh url>,因为您已经创建了 ssh 密钥。获取 repo 后,我使用以下命令更改远程地址git remote set-url <https url to repo>
Obs.:更改http.postBuffer可能还需要为gitlab设置Nginx配置文件,以通过调整client_max_body_size的值来接受客户端更大的主体大小.
但是,如果您可以访问Gitlab计算机或其网络中的计算机,则可以使用git bundle.
git bundle create my-repo.bundle --allgit clone my-repo.bundlegit remote set-url origin "path/to/your/repo.git"git push 祝一切顺利!
小智 7
如果您正在使用 https 并且您收到错误。
我使用 https 而不是 http,它解决了我的问题
git config --global https.postBuffer 524288000
Run Code Online (Sandbox Code Playgroud)
使用以下命令后我得到了解决方案:
git repack -a -f -d --window=250 --depth=250
这是由于互联网连接问题,我遇到了同样的问题。我做了一个浅拷贝的代码使用
git clone --depth 1 //FORKLOCATION
Run Code Online (Sandbox Code Playgroud)
后来使用
git fetch --unshallow
Run Code Online (Sandbox Code Playgroud)
对于共享带宽,尝试在负载较小时进行克隆。否则,请尝试使用高速连接。如果还是不行,请使用下面的命令,
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
Run Code Online (Sandbox Code Playgroud)
并再次尝试克隆。您可能需要根据可用内存大小更改这些设置。
小智 5
我遇到了同样的问题,我用试错法解决了这个问题。我更改了 core.compression 值,直到它起作用为止。
3 次尝试后,我从“git config --global core.compression 1”开始
“git config --global core.compression 4”对我有用。
| 归档时间: |
|
| 查看次数: |
296062 次 |
| 最近记录: |