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

GitGitlab

Git Problem Overview


I'm facing this error when I try to clone a repository from GitLab (GitLab 6.6.2 4ef8369):

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

The clone is then aborted. How can I avoid this?

Git Solutions


Solution 1 - Git

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 - Git

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

  1. Git provider (GitLab what I am using, GitHub).
  2. 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 - Git

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 - Git

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 - Git

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

Solution 6 - Git

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

Solution 7 - Git

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

Solution 8 - Git

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.

Solution 9 - Git

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

Solution 10 - Git

Usually it happen because of one of the below reasone:

  1. Slow Internet.
  • Switching to LAN cable with stable network connection helps in many cases. Avoid doing any parallel network intensive task while you are fetching.
  1. Small TCP/IP connection time out on Server side from where you are trying to fetch.
  • Not much you can do about. All you can do is request your System Admin or CI/CD Team responsible to increaseTCP/IP Timeout and wait.
  1. Heavy Load on Server.
  • Due to heavy server load during work hour downloading a large file can fail constantly.Leave your machine after starting download for night.
  1. Small HTTPS Buffer on Client machine.
  • Increasing buffer size for post and request might help but not guaranteed

> git config --global http.postBuffer 524288000 > > git config --global http.maxRequestBuffer 524288000 > > git config --global core.compression 0

Solution 11 - Git

This error seems to happen more commonly with a slow, or troubled internet connection. I have connected with good internet speed then it is worked perfectly.

Solution 12 - Git

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

Solution 13 - Git

This problem arrive when you are proxy issue or slow network. You can go with the depth solution or

git fetch --all  or git clone 

    

If this give error of curl 56 Recv failure then download the file via zip or spicify the name of branch instead of --all

git fetch origin BranchName 

Solution 14 - Git

For me what worked is, as this error may occur for memory requirement of git. I have added these lines to my global git configuration file .gitconfig which is present in $USER_HOME i.e C:\Users\<USER_NAME>\.gitconfig

[core] 
packedGitLimit = 512m 
packedGitWindowSize = 512m 
[pack] 
deltaCacheSize = 2047m 
packSizeLimit = 2047m 
windowMemory = 2047m

Solution 15 - Git

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

Solution 16 - Git

I am facing this problem also. resolve it. The problem is the slow internet connection. Please check your internet connection nothing else. I have connected with good internet speed then it is worked perfectly. hope it helped you.

Solution 17 - Git

This problem usually occurs while cloning large repos. If git clone http://github.com/large-repository --depth 1 does not work on windows cmd. Try running the command in windows powershell.

Solution 18 - Git

can be two reason

  1. Internet is slow (this was in my case)
  2. buffer size is less,in this case you can run command git config --global http.postBuffer 524288000

Solution 19 - Git

This problem is solved 100%. I was facing this problem , my project manager change the repo name but i was using old repo name.

Engineer@-Engi64 /g/xampp/htdocs/hospitality
$ git clone https://git-codecommit.us-east-2.amazonaws.com/v1/repo/cms
Cloning into 'cms'...
remote: Counting objects: 10647, done.
error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

How i solved this problem. Repo link was not valid so that's why i am facing this issue. Please check your repo link before cloning.

Solution 20 - Git

This works for me

export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1

Solution 21 - Git

I got the same issue while pushing some code to Github.

I tried git config --global http.postBuffer 524288000 but It didn't work for me.

Reason

It was because your commit history and/or any file(s) size is bigger.

My Case

In my case, package-lock.json was causing the problem. It was 1500+KB in size and 33K lines of code.

How I solved it?

  1. I commit and pushed everything without package-lock.json
  2. Copy the content of package-lock.json.
  3. Created a new file with the name of package-lock.json from the GitHub repo page.
  4. Paste the content of package-lock.json and commit.
  5. git pull on local.

And Done.

Tips

  • Maintain each commit size smaller
  • Push frequently
  • Use a good internet connection

I hope it helped you.

Solution 22 - Git

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.

Solution 23 - Git

These steps are working for me:

cd [dir]
git init
git clone [your Repository Url]

I hope that works for you too.

Solution 24 - Git

try this

$ git config --global user.name "John Doe"
$ git config --global user.email [email protected]

https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup

this is work for me.. capture.png

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDao Minh ThuView Question on Stackoverflow
Solution 1 - GitKhader M AView Answer on Stackoverflow
Solution 2 - GitJames GrahamView Answer on Stackoverflow
Solution 3 - GitNikhilPView Answer on Stackoverflow
Solution 4 - GitPurushottam PadhyaView Answer on Stackoverflow
Solution 5 - GitVaibhav JainView Answer on Stackoverflow
Solution 6 - GitMike YangView Answer on Stackoverflow
Solution 7 - GitJinwawaView Answer on Stackoverflow
Solution 8 - GitSergey GindinView Answer on Stackoverflow
Solution 9 - GitYuresh KarunanayakeView Answer on Stackoverflow
Solution 10 - GitHitesh SahuView Answer on Stackoverflow
Solution 11 - GitJitendra RathorView Answer on Stackoverflow
Solution 12 - GitFrancisco EduardoView Answer on Stackoverflow
Solution 13 - GitGajender SinghView Answer on Stackoverflow
Solution 14 - GitVipul PatilView Answer on Stackoverflow
Solution 15 - GitMindBlower3View Answer on Stackoverflow
Solution 16 - GitPraveen Kumar VermaView Answer on Stackoverflow
Solution 17 - GitVardaanView Answer on Stackoverflow
Solution 18 - GitAdityaView Answer on Stackoverflow
Solution 19 - GitKaleemullahView Answer on Stackoverflow
Solution 20 - GitJoshua GalitView Answer on Stackoverflow
Solution 21 - GitShakil AlamView Answer on Stackoverflow
Solution 22 - GitBingnanView Answer on Stackoverflow
Solution 23 - Gitwen jiangView Answer on Stackoverflow
Solution 24 - GitFerdhika YudiraView Answer on Stackoverflow