How to Solve Error Message error: RPC failed; curl 56 Recv failure: Connection reset by peer when Cloning a Git Repository

Posted on

This article will inform about how to solve a specific error message. The error message appears upon cloning an instance exist in the private Git Repository. In this context, it is a simple task to clone a repository exist in the Gitlab Repository. Below is the complete error message :

user@hostname:~/docker/apps$ git clone http://srv.mygitlab.net/gitlab/project/myapp.git
Cloning into 'myapp'...
Username for 'http://srv.mygitlab.net': myself 
Password for 'http://myself@srv.mygitlab.net': 
remote: Enumerating objects: 4737, done.
remote: Counting objects: 100% (4737/4737), done.
remote: Compressing objects: 100% (2600/2600), done.
error: RPC failed; curl 56 Recv failure: Connection reset by peer
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

user@hostname:~/docker/apps$

According to the output of the above error message, the process for cloning a Git-based repository doesn’t end well. The repository cloning itself stop in the middle of the process. So, there is no clone repository exist after the above command execution. It is because the result from executing the above command ends in failure. The reason behind the failure is actually the size of the repository for cloning process. The size is too large and it cause the process terminate in the middle of the cloning process. In order to solve the problem, there is a solution in order to achieve it. It is done by changing the HTTP Post buffer value of the Git command. The following is the steps for execution sequence of the solution for solving the problem :

1. Try to check the setting for the HTTP Post Buffer of the git command. Just execute the following command pattern :

git config --get http.postBuffer

The following is the execution of the above command pattern in the first place before configuring the value of it :

user@hostname:~/docker/app$ git config --get http.postBuffer
user@hostname:~/docker/app$

2. Apparently, at first it doesn’t generate any output because of there is no definite value set before. Although it doesn’t appear any output in the form of number indicating the size of the HTTP Post Buffer, by default it has the size of 1 MB. So, in order to increase the size for the HTTP Post Buffer, just give the number as in the following example :

user@hostname:~/docker/app$ git config --global http.postBuffer 52428800
user@hostname:~/docker/app$

3. The setting above is for defining the HTTP Post Buffer into 500 MB. So, in order to make sure that the value definition is exactly correct, just execute the following command to retrieve the HTTP Post Buffer value :

user@hostname:~/docker/app$ git config --get http.postBuffer
52428800
use@hostname:~/docker/app$ 

Actually, the solution for the above problem exists in the following link. Just read it to get additional information on how to solve the problem. Finally, try to clone the repository again as it exist in the previous part.

Leave a Reply