When pushing to a remote Git repository, the following error may occur and cause it to fail.
error: unable to rewind rpc post data - try increasing http.postBuffer error: RPC failed; curl 56 LibreSSL SSL_read: Connection reset by peer, errno 54 send-pack: unexpected disconnect while reading sideband packet
In my case, this error occurred when pushing to AWS CodeCommit. There are two ways to fix it.
Method 1: Increase the http.postBuffer
The method 1 is to increase the value of
http.postBuffer as it is output to the shell. Do the following
git config --global http.postBuffer 524288000
The value may vary depending on the environment, but for now, specify a large value since a large value should be sufficient.
In some cases, this method seems to fix the problem, but in my case, this method did not fix it.
Method 2: Change the connection protocol.
The error output to the shell indicates that there is a problem with the capacity of the http transfer. Git supports connections via
ssh as well as
https. To connect with the
ssh , do following.
You need to register your public key of
ssh to connect with
Change the URL to the
ssh connection URL with
git remote set-url.
git remote set-url origin ssh://URL_TO_REPOSITORY
Verify the URL with
git remote -v. Normally, both
push are changed in STEP 2, but sometimes only
push remains the same. In this case, change the URL for
push as follows.
git remote set-url --push origin ssh://URL_TO_REPOSITORY
In my case, I was able to solve the problem by changing to
ssh, Method 2, and was able to push successfully.