143

I cloned a git repo that I have hosted on github to my laptop. I was able to successfully push a couple of commits to github without problem. However, now I get the following error:

Compressing objects: 100% (792/792), done.
error: RPC failed; result=22, HTTP code = 411
Writing objects: 100% (1148/1148), 18.79 MiB | 13.81 MiB/s, done.
Total 1148 (delta 356), reused 944 (delta 214)

From here it just hangs and I finally have to CTRL + C back to the terminal.

Paolo Forgia
  • 6,572
  • 8
  • 46
  • 58
Stephen Melvin
  • 3,696
  • 2
  • 27
  • 40

7 Answers7

322

I had the same issue and believe that it has to do with the size of the repo (edited- or the size of a particular file) you are trying to push.

Basically I was able to create new repos and push them to github. But an existing one would not work.

The HTTP error code seems to back me up it is a 'Length Required' error. So maybe it is too large to calc or greated that the max. Who knows.

EDIT

I found that the problem may be files that are large. I had one update that would not push even though I had successful pushes up to that point. There was only one file in the commit but it happened to be 1.6M

So I added the following config change

git config http.postBuffer 524288000

To allow up to the file size 500M and then my push worked. It may have been that this was the problem initially with pushing a big repo over the http protocol.

END EDIT

the way I could get it to work (EDIT before I modified postBuffer) was to tar up my repo, copy it to a machine that can do git over ssh, and push it to github. Then when you try to do a push/pull from the original server it should work over https. (since it is a much smaller amount of data than an original push).

Asclepius
  • 57,944
  • 17
  • 167
  • 143
Will
  • 8,102
  • 5
  • 30
  • 32
  • Worked for me too, though I had an HTTP 501 error rather than the 411. Thanks! – Emaad Ahmed Manzoor Mar 14 '11 at 02:51
  • 1
    Thanks! this worked, and even speed up the upload. Was trying to push a website to the new Windows Azure Websites and it kept failing. – Jake Jul 06 '12 at 15:44
  • 26
    Is there a downside to just setting this value very high? – snogglethorpe Feb 06 '13 at 01:09
  • @snogglethorpe Potentially: "Transfer-Encoding: chunked is used to avoid creating a massive pack file locally". If you set the value to something huge, you can end up generating massive pack files when you attempt to push. Not all filesystems handle massive files well and they may not prune efficiently. You can see these files in .git/objects/pack. – hemp Apr 24 '18 at 20:53
  • Changing the `http.postBuffer` is more _unnecessary_ than harmful, but there is a negative side effect: Increasing it above the default may increase latency for larger pushes (since the client will buffer the HTTP request into larger chunks). – Swatantra Kumar May 29 '18 at 09:57
  • @snogglethorpe I have written an [answer](https://stackoverflow.com/a/64565533/) on a different thread attempting to note why this value can be as high as 2000000000 (2 GB). – Asclepius Oct 28 '20 at 02:13
  • Worked perfectly for me too. – Vishism Aug 26 '21 at 01:24
10

If this command not help

git config http.postBuffer 524288000

Try to change ssh method to https

git remote -v
git remote rm origin 
git remote add origin https://github.com/username/project.git
nilsK
  • 4,323
  • 2
  • 26
  • 40
Nisk
  • 1,084
  • 9
  • 9
5

Looks like a server issue (i.e. a "GitHub" issue).
If you look at this thread, it can happen when the git-http-backend gets a corrupted heap.(and since they just put in place a smart http support...)
But whatever the actual cause is, it may also be related with recent sporadic disruption in one of the GitHub fileserver.

Do you still see this error message? Because if you do:

  • check your local Git version (and upgrade to the latest one)
  • report this as a GitHub bug.

Note: the Smart HTTP Support is a big deal for those of us behind an authenticated-based enterprise firewall proxy!

From now on, if you clone a repository over the http:// url and you are using a Git client version 1.6.6 or greater, Git will automatically use the newer, better transport mechanism.
Even more amazing, however, is that you can now push over that protocol and clone private repositories as well. If you access a private repository, or you are a collaborator and want push access, you can put your username in the URL and Git will prompt you for the password when you try to access it.

Older clients will also fall back to the older, less efficient way, so nothing should break - just newer clients should work better.

So again, make sure to upgrade your Git client first.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I got similar troubles behind a ADSL wireless router (French Orange Livebox): impossible to publish my SSH key at https://github.com, push stuck over https... until I use an alternate internet access. – Yves Martin Sep 17 '12 at 20:11
  • The Smart HTTP Support managed to get me through our firewall proxy when I was getting "error: RPC failed; result=22, HTTP code = 0" when I tried to push. – Boggin Jun 26 '13 at 11:16
  • @Boggin Yes, I confirm smart http is generally the preferred choice when one is behind a proxy. The standard http/https port are (almost) always opened. – VonC Jun 26 '13 at 11:18
0

I tried to push to my own hosted bonobo-git server, and did not realise, that the http.postbuffer meant the project directory ...

so just for other confused ones:

why? In my case, I had large zip files with assets and some PSDs pushed as well - to big for the buffer I guess.

How to do this http.postbuffer: execute that command within your project src directory, next to the .git folder, not on the server.

be aware, large temp (chunk) files will be created of that buffer size.

Note: Just check your largest files, then set the buffer.

BananaAcid
  • 3,221
  • 35
  • 38
0

None of these worked for me - the solution was to stage my repo bit by bit as follow:

git add -- . ':!path/to/big_folder_1'
git commit -m "commit x"
git push

... repeat
Maxime Beau
  • 688
  • 10
  • 6
-2

The Problem to push mostly is because of the size of the files that need to be pushed. I was trying to push some libraries of just size 2 mb, then too the push was giving error of RPC with result 7. The line is of 4 mbps and is working fine. Some subsequent tries to the push got me success. If such error comes, wait for few minutes and keep on trying.

I also found out that there are some RPC failures if the github is down or is getting unstable network at their side.

So keeping up trying after some intervals is the only option!

Apurv Nerlekar
  • 2,310
  • 1
  • 21
  • 29
-3

in these cases you can try ssh if https is stuck.

Also you can try increasing the buffer size to an astronomical figure so that you dont have to worry about the buffer size any more git config http.postBuffer 100000000