Partager via


Git: Stop changing http.postBuffer...

EDIT (5/26/2017): added "Check if these hotfixes are applicable if your TFS server is running Windows 2012 R2 or earlier" section

If you see an RPC failed error during git push, like...

error: RPC failed; result=22, HTTP code = 404

or

error: RPC failed; result=22, HTTP code = 411

or

Unable to rewind rpc post data - try increasing http.postBuffer error: RPC failed; result=56, HTTP code = 0

... and search for help on Stack Overflow or MSDN forums, you'll see a lot of old recommendations to set http.postBuffer.

Don't do it! At least not blindly. Instead:

Upgrade Git

If you're still running a Git client that's version 1.9.5 or older(!) you should really upgrade Git first (we’re up to 2.8+ now). There are a bug fixes (like this one) in newer versions of Git that should obviate the need to set http.postBuffer.

We had enough support requests from internal users and external customers hitting bugs in older versions of Git that we decided to add a server-side reminder to TFS/VSTS a few sprints ago:
M:\tmp\foo>git fetch remote: Microsoft (R) Visual Studio (R) Team Services remote: We noticed you're using an older version of Git. For a better experience, upgrade to the latest version at https://git-scm.com/downloads remote: Found 4 objects to send. (6 ms) Unpacking objects: 100% (4/4), done.

Check if these hotfixes are applicable if your TFS server is running Windows 2012 R2 or earlier

Check if you're using a proxy or load balancer

If you're using a terrible proxy that's buggy or doesn’t support chunked encoding, you'll see errors for larger pushes. The same thing can happen if you put on-prem TFS behind a misconfigured load balancer. If the same push succeeds when bypassing the proxy, or bypassing the load balancer (e.g. by pushing to localhost from the server itself), then fix your proxy or load balancer instead!

What if my proxy or load balancer is broken, but I don't have any control over it?

This is the only scenario that I've seen where setting http.PostBuffer is useful for newer versions of Git.

Is setting http.postBuffer harmful?

AFAICT, it's more unnecessary than harmful, but there are a few negative side effects:

  • Increasing it above the default may increase latency for larger pushes (since the client will buffer the HTTP request into larger chunks).
  • If you set it larger than the HTTP chunk size limit for your HTTP server (e.g. maxAllowedContentLength and maxRequestLength in web.config for TFS servers), then all pushes larger than the chunk size limit will start failing.

How do I unset http.postBuffer if I've already set it?

To check if it's set, run:
git config --show-origin --get-all http.postBuffer

You may have to unset it in both your global .gitconfig file:
git config --global --unset http.postBuffer
As well as in your repo level .git/config (which overrides the global setting):
git config --local --unset http.postBuffer

Comments

  • Anonymous
    May 23, 2018
    I have upgraded Git version to 2.14.3, but I still encounter the same issue, Do you know how to fix it ?
    • Anonymous
      June 01, 2018
      The comment has been removed