Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal: unable to access ".....": gnutls_handshake() failed: Handshake failed

I've been using Git for the past few months. Recently when I try to clone or to push, I keep on getting this error. I've researched on the internet but so far no solution has worked for me. Does anyone have an idea?

External note : Now I moved to different country, it was working perfectly where I was before. Git Version : 2.11.0 , OS : Debian GNU/Linux 9.11 (stretch)

Error :

git push
fatal: unable to access 'https://**************/': gnutls_handshake() failed: Handshake failed
like image 857
Harish Kanna Avatar asked Feb 17 '20 12:02

Harish Kanna


Video Answer


4 Answers

This is solution fix this issue on ubuntu server 14.04.x

1, Edit file:

sudo nano  /etc/apt/sources.list

2, Add to file sources.list

deb http://security.ubuntu.com/ubuntu xenial-security main
deb http://cz.archive.ubuntu.com/ubuntu xenial main universe

3, Run command update and update CURL to new version

apt-get update && apt-get install curl

4, Check version (Optional):

curl -V
Response :

curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets 

5, Test connect with bitbucket (Optional)

GIT_CURL_VERBOSE=1 git ls-remote https://bitbucket.org/
Response:


* Closing connection 0
fatal: repository 'https://bitbucket.org/' not found

This done.

like image 150
Jigar Bhatt Avatar answered Oct 19 '22 07:10

Jigar Bhatt


I also incurred this problem with Ubuntu 14.04 LTS. Quickest solution is to use ssh instead of https. Following are steps to replace https from ssh:

  1. Generate ssh key using ssh-keygen on the server.

  2. Copy public key from generated id_rsa.pub file from step 1 and add it at following links depending on repository host -

    Bitbucket - https://bitbucket.org/account/settings/ssh-keys/

    Github - https://github.com/settings/ssh/new

    Gitlab - https://gitlab.com/profile/keys

  3. Now run following command to test authentication from server command line terminal

    Bitbucket

    ssh -T [email protected]
    Github
    ssh -T [email protected]
    Gitlab
    ssh -T [email protected]
  4. Go to repo directory and open .git/config file using emac or vi

  5. Replace remote "origin" url (which starts with https) with following -

    For Bitbucket - [email protected]:<username>/<repo>.git

    For Github - [email protected]:<username>/<repo>.git

    For Gitlab - [email protected]:<username>/<repo>.git

like image 26
Amit Jaiswal Avatar answered Oct 19 '22 05:10

Amit Jaiswal


This error means that Git cannot establish a secure connection to the server you're trying to use. Your version of Git uses the GnuTLS library to set up TLS (encrypted) connections, and for some reason that setup process is failing.

This could be for a couple of reasons. One is that your server (which one you haven't mentioned) is using an incompatible set of cipher suites or TLS versions, and there's no encryption algorithms in common that can be chosen. It's also possible that you have someone tampering with the connection via a MITM device.

The version of Git and GnuTLS you're using should work just fine with most standard servers. Re-installing it won't help. You can try upgrading to a newer version of Debian, or you can try building Git yourself against a version of libcurl using OpenSSL. You can also just switch to SSH-based remotes, which will avoid this incompatibility altogether.

like image 11
bk2204 Avatar answered Oct 19 '22 05:10

bk2204


I got the same error.

You could try to compile git with OpenSSL instead of gnutls using Paul N. Baker's shell script.

  1. Create file.sh
  2. Put the code of the link into this file
  3. Give permission to this file: chmod a+x file.sh
  4. Run: sudo ./file.sh

This shell script works for me.

like image 2
Igor Matheus Avatar answered Oct 19 '22 05:10

Igor Matheus