git 错误:RPC 失败;curl 传输关闭,剩余未完成的读取数据

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38618885/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 04:25:29  来源:igfitidea点击:

error: RPC failed; curl transfer closed with outstanding read data remaining

gitgitlab

提问by Do Nhu Vy

I try to clone a repository from GitLab (GitLab 6.6.2 4ef8369) and error:

我尝试从 GitLab (GitLab 6.6.2 4ef8369) 克隆一个存储库并出现错误:

enter image description here

在此处输入图片说明

remote: Counting objects: 66352, done.
remote: Compressing objects: 100% (10417/10417), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

How to avoid this error?

如何避免这个错误?

采纳答案by Do Nhu Vy

After few days, today I just resolved this problem. Generate ssh key, follow this article:

几天后,今天我刚刚解决了这个问题。生成 ssh 密钥,参考这篇文章:

https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

Declare it to

声明它

  1. Git provider (GitLab what I am using, GitHub).
  2. Add this to local identity.
  1. Git 提供者(我正在使用的 GitLab,GitHub)。
  2. 将此添加到本地身份。

Then clone by command:

然后通过命令克隆:

git clone [email protected]:my_group/my_repository.git

And no error happen.

并且没有错误发生。

The above problem

上面的问题

error: RPC failed; curl 18 transfer closed with outstanding read data remaining

错误:RPC 失败;curl 18 传输关闭,剩余读取数据未完成

because have error when clone by HTTP protocol (curlcommand).

因为通过 HTTP 协议(curl命令)克隆时出错。

And, you should increment buffer size:

而且,您应该增加缓冲区大小:

git config --global http.postBuffer 524288000

回答by Khader M A

It happens more often than not, I am on a slow internet connection and I have to clone a decently-huge git repository. The most common issue is that the connection closes and the whole clone is cancelled.

它经常发生,我的互联网连接速度很慢,我必须克隆一个相当大的 git 存储库。最常见的问题是连接关闭,整个克隆被取消。

Cloning into 'large-repository'...
remote: Counting objects: 20248, done.
remote: Compressing objects: 100% (10204/10204), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining 
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

After a lot of trial and errors and a lot of “remote end hung up unexpectedly” I have a way that works for me. The idea is to do a shallow clone first and then update the repository with its history.

经过大量的试验和错误以及大量的“远程端意外挂断”,我有一种适合我的方法。这个想法是先做一个浅克隆,然后用它的历史更新存储库。

$ git clone http://github.com/large-repository --depth 1
$ cd large-repository
$ git fetch --unshallow

回答by Purushottam Padhya

When I tried cloning from the remote, got the same issue repeatedly:

当我尝试从远程克隆时,反复遇到同样的问题:

remote: Counting objects: 182, done.
remote: Compressing objects: 100% (149/149), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

Finally this worked for me:

最后这对我有用:

git clone https://[email protected]/repositoryName.git --depth 1

回答by Jinwawa

These steps worked for me:using git://instead of https://

这些步骤对我有用:使用git://而不是https://

回答by Yang

Network connection problems.
Maybe due to the persistent connection timeout.
The best way is to change to another network.

网络连接问题。
可能是由于持久连接超时。
最好的方法是换到另一个网络。

回答by Sergey Gindin

As above mentioned, first of all run your git command from bash adding the enhanced log directives in the beginning: GIT_TRACE=1 GIT_CURL_VERBOSE=1 git ...

如上所述,首先从 bash 运行您的 git 命令,并在开头添加增强的日志指令: GIT_TRACE=1 GIT_CURL_VERBOSE=1 git ...

e.g. GIT_CURL_VERBOSE=1 GIT_TRACE=1 git -c diff.mnemonicprefix=false -c core.quotepath=false fetch originThis will show you detailed error information.

例如,GIT_CURL_VERBOSE=1 GIT_TRACE=1 git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin这将显示详细的错误信息。

回答by Vaibhav Jain

Simple Solution: Rather then cloning via https, clone it via ssh.

简单的解决方案:与其通过 https 克隆,不如通过 ssh 克隆。

For example:

例如:

git clone https://github.com/vaibhavjain2/xxx.git - Avoid
git clone [email protected]:vaibhavjain2/xxx.git - Correct

回答by Francisco Eduardo

With me this problem occurred because the proxy configuration. I added the ip git server in the proxy exception. The git server was local, but the no_proxy environment variable was not set correctly.

与我发生此问题的原因是代理配置。我在代理异常中添加了ip git服务器。git 服务器是本地的,但是没有正确设置 no_proxy 环境变量。

I used this command to identify the problem:

我使用此命令来确定问题:

#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

In return there was the "Proxy-Authorization" as the git server was spot should not go through the proxy. But the real problem was the size of the files defined by the proxy rules

作为回报,有“代理授权”,因为 git 服务器不应该通过代理。但真正的问题是代理规则定义的文件大小

回答by Yuresh Karunanayake

For me, the issue was that the connection closes before the whole clone complete. I used ethernet instead of wifi connection. Then it solves for me

对我来说,问题是连接在整个克隆完成之前关闭。我使用以太网而不是 wifi 连接。然后它为我解决

回答by MindBlower3

Tried all of the answers on here. I was trying to add cocoapods onto my machine.

尝试了这里的所有答案。我试图在我的机器上添加 cocoapods。

I didn't have an SSH key so thanks @Do Nhu Vy

我没有 SSH 密钥所以谢谢@Do Nhu Vy

https://stackoverflow.com/a/38703069/2481602

https://stackoverflow.com/a/38703069/2481602

And finally used

并最终使用

git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master

to finally fix the issue found https://stackoverflow.com/a/50959034/2481602

最终解决发现的问题https://stackoverflow.com/a/50959034/2481602