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
7
Answers
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.
I got the same error.
You could try to compile git with OpenSSL instead of gnutls using Paul N. Baker’s shell script.
file.sh
chmod a+x file.sh
sudo ./file.sh
This shell script works for me.
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:
Generate ssh key using ssh-keygen on the server.
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
Now run following command to test authentication from server command line terminal
Bitbucket
Github
Gitlab
Go to repo directory and open .git/config file using emac or vi
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
This is solution fix this issue on ubuntu server 14.04.x
1, Edit file:
2, Add to file sources.list
3, Run command update and update CURL to new version
4, Check version (Optional):
5, Test connect with bitbucket (Optional)
This done.
If you are using Ubuntu 20.04 as mine, using personal computer (with no proxy configured), then just update your
gnutls-bin
to the latest versionI figure it by
even though I try
don’t show any results, but unset https.proxy still work.
It might be only a part of the problem.
How about other https sites?
How are you connected to the internet?
Is your git counterpart is reachable through VPN?
Why am I asking? I faced the same problem:
Git is used in Ubuntu 22.04 VM hosted in Windows 10 Hyper-X. VM is connected to the Internet trough Default Switch (NAT) and shares OpenConnect VPN connection of the host.
One day git failed to fetch from remote repo that was located in private network that is reachable through VPN. Symptoms were like yours:
After some investigation I found next facts:
OpenConnect Log window
After that I tried to trace path to remote git repo:
tracepath-screenshot
Where I’ve noticed some pmtu strings in the right side of the screen and a final Resume note.
So, I decided to check MTU preset for my network interface:
ifconfig-screenshot
as you can see, interface eth0 had MTU 1500 (… that was too much for current VPN tunnel).
When I’ve changed eth0 MTU to 1290, as suggested tracepath utility:
my problem was solved. (MTU has to be also changed in Ubuntu network setup settings page to take permanent effect)
Profit!
Read also: Windows WSL: Git and gnutls_handshake() failed