Post

How to Fix Git RPC failed; HTTP 400 curl 22

How to Fix Git RPC failed; HTTP 400 curl 22

While managing a project with Git, I accidentally messed up the repository quite badly. So, I decided to push everything again to the remote repository. However, I ran into the following error:

1
2
3
4
5
6
error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (394/394), 6.67 MiB | 4.99 MiB/s, done.
Total 394 (delta 33), reused 0 (delta 0), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date

From the error message, we can see that Git returned a 400: Bad Request error, and the connection was unexpectedly interrupted during the send-pack process. The last line says Everything up-to-date, but honestly, this message is not very helpful in this situation.

After looking into it, I found that this error can occur when the amount of data being pushed through Git is too large. In my case, the issue was solved by running the following command:

1
git config --global http.postBuffer 524288000

This command increases the buffer size used by Git for HTTP POST requests. After applying this configuration, the push worked without any issues.

1
2
3
4
remote: Resolving deltas: 100% (33/33), done.
To https://github.com/...git
 * [new branch]      main -> main
branch 'main' set up to track 'origin/main'.
This post is licensed under CC BY 4.0 by the author.