How to resolve the error “http.postBuffer” when pushed to the Git repository

When you attempt to push to a remote Git repository, you might encounter the following error, causing the operation 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 first method involves increasing the value of `http.postBuffer`, as suggested by the error message output to the shell. For example, you can do this as follows:

git config --global http.postBuffer 524288000

While the optimal value may vary depending on your environment, setting it to a large number should be sufficient.

In some cases, this method seems to fix the problem, but in my case, it did not.

Method 2: Change the connection protocol.

The error message output to the shell suggests an issue with the capacity of the HTTP transfer. Git supports connections via ssh as well as https. To connect with the ssh , do the following.

STEP
Upload your public key to the server.

You’ll need to register your ssh public key to establish a connection using the ssh protocol.

STEP
Change the repository URL.

Change the URL to the ssh connection URL with git remote set-url.

git remote set-url origin ssh://URL_TO_REPOSITORY
STEP
Verify the URL.

Check the URL using git remote -v. Typically, both the fetch and push URLs are changed in STEP 2, but in some cases, only the push URL might remain unchanged. In this case, change the URL for push as follows.

git remote set-url --push origin ssh://URL_TO_REPOSITORY

In my case, I solved the problem by changing to ssh, Method 2, and could push successfully.

著書紹介

よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

この記事を書いた人

Akira Hayashi (林 晃)のアバター Akira Hayashi (林 晃) Representative(代表), Software Engineer(ソフトウェアエンジニア)

アールケー開発代表。Appleプラットフォーム向けの開発を専門としているソフトウェアエンジニア。ソフトウェアの受託開発、技術書執筆、技術指導・セミナー講師。note, Medium, LinkedIn
-
Representative of RK Kaihatsu. Software Engineer Specializing in Development for the Apple Platform. Specializing in contract software development, technical writing, and serving as a tech workshop lecturer. note, Medium, LinkedIn

目次