问题
I try to clone a repository from GitLab (GitLab 6.6.2 4ef8369) and error:
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?
回答1:
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.
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
回答2:
After few days, today I just resolved this problem. Generate ssh key, follow this article:
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
Declare it to
- Git provider (GitLab what I am using, GitHub).
- Add this to local identity.
Then clone by command:
git clone username@mydomain.com:my_group/my_repository.git
And no error happen.
The above problem
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
because have error when clone by HTTP protocol (curl
command).
And, you should increment buffer size:
git config --global http.postBuffer 524288000
回答3:
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://username@bitbucket.org/repositoryName.git --depth 1
回答4:
Network connection problems.
Maybe due to the persistent connection timeout.
The best way is to change to another network.
回答5:
These steps worked for me:using git://
instead of https://
回答6:
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 ...
e.g. GIT_CURL_VERBOSE=1 GIT_TRACE=1 git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
This will show you detailed error information.
回答7:
Simple Solution: Rather then cloning via https, clone it via ssh.
For example:
git clone https://github.com/vaibhavjain2/xxx.git - Avoid
git clone git@github.com:vaibhavjain2/xxx.git - Correct
回答8:
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.
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
回答9:
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
回答10:
Changing git clone protocol to try.
for example, this error happened when "git clone https://xxxxxxxxxxxxxxx"
you can try with "git clone git://xxxxxxxxxxxxxx", maybe ok then.
回答11:
Tried all of the answers on here. I was trying to add cocoapods onto my machine.
I didn't have an SSH key so thanks @Do Nhu Vy
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
回答12:
These steps are working for me:
cd [dir]
git init
git clone [your Repository Url]
I hope that works for you too.
回答13:
try this
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
this is work for me.. capture.png
来源:https://stackoverflow.com/questions/38618885/error-rpc-failed-curl-transfer-closed-with-outstanding-read-data-remaining