Skip to content
Latchkey

Git "RPC failed; HTTP 400 ... result=22" on Push in CI

A push was rejected with HTTP 400 before Git could send the whole pack. The usual cause is a request body larger than a proxy or server allows, so the upload is refused outright.

What this error means

A git push (often the first push of a large history) fails with error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400. Small pushes to the same remote succeed.

git push output
error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly

Common causes

Body larger than a proxy/server limit

A reverse proxy in front of the Git host caps request body size. A large pack exceeds it and the proxy returns 400 before the push completes.

Pack chunked in a way the proxy rejects

With a small http.postBuffer, Git uses chunked transfer encoding that some proxies reject with 400; buffering the whole body avoids it.

How to fix it

Raise the HTTP post buffer

A buffer larger than the pack lets Git send a single non-chunked body, which most proxies accept.

Terminal
git config --global http.postBuffer 524288000   # 500 MB

Push less at once or use SSH

  1. Push the history in smaller commit ranges instead of one giant pack.
  2. Switch the remote to SSH, which is not subject to the HTTP body limit.
  3. If you control the server proxy, raise its max request body size.

How to prevent it

  • Raise http.postBuffer on runners that push large packs over HTTPS.
  • Prefer SSH for very large initial pushes.
  • Keep proxy body-size limits aligned with your largest expected push.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →