gpt4 book ai didi

git - git克隆时远程端意外挂断

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:23:24 26 4
gpt4 key购买 nike

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

这可能是什么问题?

注意:我已经向 GIT 托管提供商注册了我的 SSH key

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

(对于 npm publishMartin Braun 报告 in the comments 将其设置为不超过 50 000 000 而不是默认的 1 000 000)

###更多信息:

来自git config man page , http.postBuffer 是关于:

Maximum size in bytes of the buffer used by smart HTTP transports when POSTing data to the remote system.
For requests larger than this buffer size, HTTP/1.1 and Transfer-Encoding: chunked is used to avoid creating a massive pack file locally. Default is 1 MiB, which is sufficient for most requests.

即使对于克隆,这也会产生影响,在这种情况下,OP Joe报告:

[clone] works fine now


注意:如果服务器端出现问题,并且服务器使用 Git 2.5+(2015 年第 2 季度),错误消息可能会更明确。
参见“Git cloning: remote end hung up unexpectedly, tried changing postBuffer but still failing”。


Kulai ( in the comments ) 指出 this Atlassian Troubleshooting Git page ,它增加了:

Error code 56 indicates a curl receive the error of CURLE_RECV_ERROR which means there was some issue that prevented the data from being received during the cloning process.
Typically this is caused by a network setting, firewall, VPN client, or anti-virus that is terminating the connection before all data has been transferred.

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

# 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

有了 Git 2.25.1(2020 年 2 月),您对这个http.postBuffer“解决方案”有了更多了解。

参见 commit 7a2dc95 , commit 1b13e90 (2020 年 1 月 22 日)brian m. carlson (bk2204) .
(由 Junio C Hamano -- gitster -- merge 于 commit 53a8329 ,2020 年 1 月 30 日)
( Git Mailing list discussion )

docs: mention when increasing http.postBuffer is valuable

Signed-off-by: brian m. carlson

Users in a wide variety of situations find themselves with HTTP push problems.

Oftentimes these issues are due to antivirus software, filtering proxies, or other man-in-the-middle situations; other times, they are due to simple unreliability of the network.

However, a common solution to HTTP push problems found online is to increase http.postBuffer.

This works for none of the aforementioned situations and is only useful in a small, highly restricted number of cases: essentially, when the connection does not properly support HTTP/1.1.

Document when raising this value is appropriate and what it actually does, and discourage people from using it as a general solution for push problems, since it is not effective there.

因此 git config http.postBuffer 的文档现在包括:

http.postBuffer

Maximum size in bytes of the buffer used by smart HTTP transports when POSTing data to the remote system.
For requests larger than this buffer size, HTTP/1.1 and Transfer-Encoding: chunked is used to avoid creating a massive pack file locally.
Default is 1 MiB, which issufficient for most requests.

Note that raising this limit is only effective for disabling chunked transfer encoding and therefore should be used only where the remote server or a proxy only supports HTTP/1.0 or is noncompliant with the HTTP standard.
Raising this is not, in general, an effective solution for most push problems, but can increase memory consumption significantly since the entire buffer is allocated even for small pushes.

关于git - git克隆时远程端意外挂断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39523145/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com