7

I found many questions with this error during cloning. But I get this while pushing to remote.

About my remote repo: Contains a lot of small files (a dataset).
Internet connection: I am behind my college network with decent speed (~10MBps) behind a proxy. I can guarantee that the proxy is not an issue.

I committed a lot of small files (more of them now). I tried to push them when I started getting this error. So I deleted all the files so to make the folder small enough after which I tried pushing it again. Now I am trying to push the small number of files(~20-30) of size ~40MB. And this shows up.

$ git push origin master Counting objects: 8124, done. Delta compression using up to 4 threads. Compressing objects: 100% (8105/8105), done. Writing objects: 100% (8124/8124), 2.64 GiB | 539.00 KiB/s, done. Total 8124 (delta 27), reused 8091 (delta 18) error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: The remote end hung up unexpectedly fatal: The remote end hung up unexpectedly Everything up-to-date 

Also, when I committed, a lot of those files were in delete mode which seems right to me as I committed them earlier. Now my files are ~40MB and my .git folder is ~6GB.

I would be very grateful if someone can help resolve the issue.

6
  • Possible duplicate of Git fails when pushing commit to github Commented Apr 23, 2019 at 20:54
  • Have you got some really big files in your commit history, such as 100MB or bigger? Are you using a proxy, such as HAProxy? Commented Apr 23, 2019 at 22:23
  • This error means your connection was truncated at some point; something on the network is causing the connection to be dropped. Very frequently when a proxy is involved, it's the proxy. Try from a different network without the proxy. Commented Apr 23, 2019 at 23:13
  • @LasseVågsætherKarlsen Yes, in the earlier commit, some large files were there. But I removed them now. While committing, I see those files in delete mode. I am behind an LDAP proxy. Commented Apr 24, 2019 at 8:07
  • @bk2204 I am previously pushed such files. I am quite sure, it's not about proxy. Commented Apr 24, 2019 at 8:08

4 Answers 4

8

Try with a different push size, meaning:

Cancel the last commit with git reset @~.

Then add only a small set of file, commit and try to push those.
Repeat for the other files.

Sign up to request clarification or add additional context in comments.

2 Comments

This is the only thing that worked for me. I replaced the @~ in the solution above with the commit code of the second last commit and then staged, committed and pushed smaller batches of files.
@AbrieNel well done. Pushing a smaller set is indeed a good option in this case.
5

increase the 'http.postBuffer' as much as is appropriate for you

git config --global http.postBuffer 524288000 

Comments

4

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
  • Try switching to SSH from HTTP

I hope it helped you.

1 Comment

This workaround solved my problem.
0

What worked for me was I canceled/reset all the commits I was trying to push

with git reset 'Commit name'.

e.g

git reset 4b8ae8f7 

Then I made a new commit with all the new files and pushed

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.