error: RPC failed; curl transfer closed with outstanding read data remaining
Solution 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
Solution 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 [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
because have error when clone by HTTP protocol (curl
command).
And, you should increment buffer size:
git config --global http.postBuffer 524288000
Solution 3:
you need to turn off the compression:
git config --global core.compression 0
then you need to use shallow clone
git clone --depth=1 <url>
then most important step is to cd into your cloned project
cd <shallow cloned project dir>
now deopen the clone,step by step
git fetch --depth=N, with increasing N
eg.
git fetch --depth=4
then,
git fetch --depth=100
then,
git fetch --depth=500
you can choose how many steps you want by replacing this N,
and finally download all of the remaining revisions using,
git fetch --unshallow
upvote if it helps you :)
Solution 4:
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
Solution 5:
Simple Solution: Rather then cloning via https, clone it via ssh.
For example:
git clone https://github.com/vaibhavjain2/xxx.git - Avoid
git clone [email protected]:vaibhavjain2/xxx.git - Correct