Search code examples
curlgit-clone

RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated


When cloning certain repositories, I am getting this error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated.. Obviously I'm not the only one with this kind of error and I started googling for some answers. Every solution that I found and applied to my machine did not yield any results so I'm desperate enough to start a stackoverflow question.

There are repositories that I can download without any errors, so the root of the problem is dependent on certain properties of repositories. The challenge lies in how to find the responsible property.

Many thanks in advance for any suggestions.


Solution

  • I solved it in the end by recompiling and reinstalling git. I am using VSCode and WSL1 20.4 and used these commands:

    sudo apt remove git -y
    sudo apt update && sudo apt upgrade
    
    DEBIAN_FRONTEND=noninteractive
    
    sudo apt install build-essential autoconf dh-autoreconf libcurl4-openssl-dev \
                     tcl-dev gettext asciidoc docbook2x install-info \
                     libexpat1-dev libz-dev -y
    
    wget https://raw.githubusercontent.com/paul-nelson-baker/git-openssl-shellscript/master/compile-git-with-openssl.sh .
    
    bash compile-git-with-openssl.sh -skiptests
    

    The commands were provided by this source. Recompiling the git takes a lot of time, especially when doing all the tests (you can removed skiptests to see if everything is ok). Unfortunatly I do not know what caused the problem, possibly conflict between GnuTls and Openssl ? Hope this answers saves the next person a headache.

    Update: This error occured again for another repo just after a few days. The cause for it are some large binary files that Git does not manage to clone. Likely this is due to an unstable connection.

    Also make sure you have the most recent version of git. In the Microsoft documentation it says the git version should be newer than 2.8. However, if you use f.e 2.37 the error will occur.