How to fix git error: RPC failed; curl 56 GnuTLS

GitUbuntu

Git Problem Overview


I use Ubuntu 16.04. When I want to git push origin master I get:

error: RPC failed; curl 56 GnuTLS recv error (-12): A TLS fatal alert has been received.
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date

Git Solutions


Solution 1 - Git

The accepted answer from @harlequin might work, but I spend 2 hours and could not build git package from source code.

However, Check the below link as this works for me.

https://stackoverflow.com/questions/6842687/the-remote-end-hung-up-unexpectedly-while-git-cloning

just update the http post buffer value

git config --global http.postBuffer 1048576000

Solution 2 - Git

After reading your posts, I solved it simply by

apt install gnutls-bin

Solution 3 - Git

To solve this issue:

Rebuilding git with openssl instead of gnutls fixed my problem.

I followed these instructions

Solution 4 - Git

I have a workaround if you need to clone or pull and the problem lies in the size of the repository history. It may also help when you want to push later, with no guarantee.

Simply retrieve the last commits with --depth=[number of last commits].

You can do this at clone time, or, if working from a local repository to which you added a remote, at pull time. For instance, to only retrieve the last commit (of each branch):

git clone repo --depth=1
# or
git pull --depth=1

UPDATE: if the remote is getting too much ahead of you, the issue may come back later as you try to pull the last changes, but there are too many and the connection closes with curl 56. You may have to git pull --depth=[number of commits ahead on remote], which is tedious if you're working on a very active repository.

Solution 5 - Git

You can set some option to resolve the issue

Either at global level: (needed if you clone, don't forget to reset after)

$ git config --global http.sslVerify false
$ git config --global http.postBuffer 1048576000

or on a local repository

$ git config http.sslVerify false
$ git config http.postBuffer 1048576000

Solution 6 - Git

I also encountered same and restart of the system resolved it :)

Solution 7 - Git

I am also using Ubuntu based system (Mint mate 18), got the similar issue when clone large repo from github.

The simple solution worked for me is to use ssh protocol instead of http(s) protocol.

e.g

git clone [email protected]:xxx/yyy.git

Solution 8 - Git

Try to upgrading openssl modules

I solved it by doing that

sudo apt install openssl

Solution 9 - Git

WSL2 users getting this with Ubuntu 18, read this. Basically you need to update your wireless driver.

Solution 10 - Git

I saw similar issues (particularly with depth) on some legacy projects when we were cloning that used to live on TFS. Enabling long paths resolved our issue and may be something else worth trying.

git config --system core.longpaths true

Solution 11 - Git

I faced this issue on Ubuntu 18.04 when cloning CppCheck using https.

A workaround to it was to use http instead.

Solution 12 - Git

All I did was disconnect and reconnect my pc from the wifi and it worked. Sometimes the answer might be very simple. Mine works now

Solution 13 - Git

Check your Network is properly working...this problem also occures because of internet issues

Solution 14 - Git

I just managed to solve this by cloning using SSH.

To do that I had to add my machine's SSH key to my account.

Solution 15 - Git

Additionally,this error may occurs in you are using any proxy in command line.

if you export any proxy before , unset it .

$ unset all_proxy && unset ALL_PROXY

Solution 16 - Git

I solved this problem by disconnecting my VPN (My OS is ubuntu-16.04).

Solution 17 - Git

For Linux: Simple you can run below commands:

1) git config -l
2) git config --global http.postBuffer 524288000
        Or set double value  1048576000
3) git config --global https.postBuffer 
4) git config --global core.compression -1 
5) service apache2 restart

Then again check the config of git

git config -l

now you can run clone command

git clone yourrepo

I hope this will be solved the issue.

Solution 18 - Git

Another way here:please try it again, sometimes it happen just result from your network status.

My situation is as below.

enter image description here

Solution 19 - Git

Try to disable your IPV6 for that and disable after. I think this is your problem.

Solution 20 - Git

I tried all the above without success. Eventually I realised I had a weak WiFi connection and therefore slow download speed. I connected my device VIA Ethernet and that solved my problem straight away.

Solution 21 - Git

I got this error while i tried to push a new branch upstream

git push --set-upstream origin xyz

I tried almost all of the git config edits suggested above including a system reboot. Nothing worked.

So I went back to master and did a pull, went back to my xyz branch, did a merge with master and was able to push.

* currently on branch xyz
git checkout master
git pull
git checkout xyz
git merge master
git push --set-upstream origin xyz

I have to say nothing in master conflicted with any of my changes in my new branch "xyx". Only a couple of new commits from master were merged to my "xyz" branch. This shouldn't have been a problem on normal days.

Solution 22 - Git

I met the same question, and solved it by using SSH protocol.

git clone [email protected]:micro/micro.git

Solution 23 - Git

Had the same problem hosting Go Git Server behind nginx and cloning:

remote: Enumerating objects: 103, done. remote: Counting objects: 100% (103/103), done. remote: Compressing objects: 100% (47/47), done. remote: Total 103 (delta 52), reused 99 (delta 51), pack-reused 0 Receiving objects: 100% (103/103), 11.56 KiB | 1.16 MiB/s, done. Resolving deltas: 100% (52/52), done. error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated.

After searching RPC based issues, there appears to he a requirement to use HTTP2

Therefore this line in my nginx site configuration:

listen 443 ssl; # managed by Certbot

Was changed to this, to enable http2 - which is not a default:

listen 443 ssl http2; # managed by Certbot

And TLS in general seems happier (i.e. I had other errors regarding curl and TLS, when inspecting verbose output)

I have verified this as a root cause by removing http2, which reproduces the error and reinstating http2 resolves the problem.

Solution 24 - Git

I had a similar fault:

error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.

when trying to clone a repository from Github.

After trying most of the solutions posted here, none of which worked, it turned out to be the parental controls on our home network. Turning these parental controls off solved the problem.

Solution 25 - Git

If you are are running the git server service, then rather than it be a git client issue ... perhaps it's a git server issue too ! This is what the solution was for me...

We were running a gitbucket server with a front-end nginx reverse proxy for https.

Following a major system OS version upgrade, we started getting this error across all git clients. Turns out that nginx got replaced and the new package's default nginx.conf got installed. The default nginx user 'www-data' was NOT what it used to be.

Somewhere underneath it all, there must have been a permissions issue, because resetting the nginx user back to it's former value, and restarting nginx got everything going again. .... go figure ! (Yes I had restarted nginx many times prior to the one singular change that solved it)

Solution 26 - Git

I am facing the same issue since yesterday, but now successfully solved that issue.

First, remove the git package and any other dependent package

$ sudo apt-get remove git

and then install git

sudo apt-get install git-all

Solution 27 - Git

I solved it by just running single command

> apt upgrade (being root user)

Solution 28 - Git

My mac was connected to a 2.5GHZ network, I had to enable my wifi to 5GHz. And the problem disappeared.

Solution 29 - Git

This solved my problem

$ git config http.sslVerify false
$ git config http.postBuffer 1048576000

Solution 30 - Git

Simply executing command

git init

before cloning resolved it for me.

Solution 31 - Git

Reinstalling git will solve the problem.

sudo apt-get remove git
sudo apt-get update
sudo apt-get install git

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionuserView Question on Stackoverflow
Solution 1 - GitShubham AgarwalView Answer on Stackoverflow
Solution 2 - Git陈家胜View Answer on Stackoverflow
Solution 3 - GitHarlequinView Answer on Stackoverflow
Solution 4 - GithsandtView Answer on Stackoverflow
Solution 5 - GitRamesh KotkarView Answer on Stackoverflow
Solution 6 - GitRootCodeView Answer on Stackoverflow
Solution 7 - GitEricView Answer on Stackoverflow
Solution 8 - GitAdithya VisnuView Answer on Stackoverflow
Solution 9 - GitSM79View Answer on Stackoverflow
Solution 10 - GitJames JonesView Answer on Stackoverflow
Solution 11 - GitBruno Alexandre RosaView Answer on Stackoverflow
Solution 12 - GittushortzView Answer on Stackoverflow
Solution 13 - Gituser10926450View Answer on Stackoverflow
Solution 14 - GitLeo TavaresView Answer on Stackoverflow
Solution 15 - GitchenlolaView Answer on Stackoverflow
Solution 16 - GitM.NamjoView Answer on Stackoverflow
Solution 17 - GitPradeep ThakurView Answer on Stackoverflow
Solution 18 - GitChase07View Answer on Stackoverflow
Solution 19 - GitThiago LúcioView Answer on Stackoverflow
Solution 20 - GitJoshView Answer on Stackoverflow
Solution 21 - GitmouseratView Answer on Stackoverflow
Solution 22 - GitsimpleView Answer on Stackoverflow
Solution 23 - GitsoapdishView Answer on Stackoverflow
Solution 24 - GitEdMc2View Answer on Stackoverflow
Solution 25 - GitTheBenjiManCanView Answer on Stackoverflow
Solution 26 - GitGanesh_KCView Answer on Stackoverflow
Solution 27 - GitHassan AsgharView Answer on Stackoverflow
Solution 28 - GitSiddharthView Answer on Stackoverflow
Solution 29 - GitMaruf SharifiView Answer on Stackoverflow
Solution 30 - GitRayies BankaView Answer on Stackoverflow
Solution 31 - GitZhui WangView Answer on Stackoverflow