How to resolve Git fatal: the remote end hung up unexpectedly

A guide on how to increase the size limit of a Git commit to avoid this error.

While attempting to commit with a batch of images to my Git repo, I encountered this error:

error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (64/64), 205.66 MiB | 17.18 MiB/s, done.
Total 64 (delta 12), reused 0 (delta 0), pack-reused 0
fatal: the remote end hung up unexpectedly

This occurred because the size of the commit exceeded Git's default size limit.

To increase the limit, use the following command:

git config http.postBuffer 524288000

Alternatively, for SSH:

git config ssh.postBuffer 524288000

This setting will accommodate changes up to 500 MB. To apply this change universally, include the —global flag. For even larger files, adjust the limit as necessary.

Keep in mind, Github's maximum file size limit is 2 GiB:

git config http.postBuffer 2147483648

Published on November 7, 2023 1 min read