git error solved: The remote end hung up unexpectedly

Sometimes, when you clone a git repository you may end up with a fatal error “The remote end hung up unexpectedly”.

For instance, typing this git command to clone a repository of mine:

git clone https://github.com/sequana/sequana

led to this message ending with the fatal error :

Cloning into 'sequana-0.8.0'...
remote: Enumerating objects: 58, done.
remote: Counting objects: 100% (58/58), done.
remote: Compressing objects: 100% (40/40), done.
error: RPC failed; result=18, HTTP code = 200KiB | 5.00 KiB/s   
fatal: The remote end hung up unexpectedly
fatal: early EOF

One solution is to increase the buffer used by git from the unix command by exporting this environment variable:

export GIT_HTTP_MAX_REQUEST_BUFFER=100M

and then it worked out of the box:

Cloning into 'sequana-0.8.0'...
remote: Enumerating objects: 58, done.
remote: Counting objects: 100% (58/58), done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 26318 (delta 31), reused 38 (delta 18), pack-reused 26260
Receiving objects: 100% (26318/26318), 17.93 MiB | 8.00 KiB/s, done.
Resolving deltas: 100% (18760/18760), done.
Checking connectivity... done.

You may do that once for all using the git config command:

git config --global http.postBuffer 100000000
Please follow and like us:
error
This entry was posted in Linux and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published.