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:
gnutls_handshake() failed
After some investigation I found next facts:
- All https resources that were reachable through VPN were ping-able with default presets from guest, but Https connection to them could not be established
- Other https resources that were not under VPN were reachable and were working normally
- While connection attempts to https resources with firefox browser I found some bad packets report in OpenConnect-GUI VPN Client Log:
OpenConnect Log window
After that I tried to trace path to remote git repo:
tracepath-screenshot
developer@Ubuntu-VM:~$ tracepath **.**.167.240 -n
1?: [LOCALHOST] pmtu 1500
1: 172.18.224.1 0.485ms
1: 172.18.224.1 0.386ms
2: 172.18.224.1 0.227ms pmtu 1290
2: **.**.254.9 38.242ms
3: **.**.30.14 32.438ms
4: **.**.167.240 32.136ms reached
Resume: pmtu 1290 hops 4 back 4
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
developer@Ubuntu-VM:~$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.18.227.200 netmask 255.255.240.0 broadcast 172.18.239.255
inet6 fe80::d1b:9e02:3919:d75b prefixlen 64 scopeid 0x20<link>
ether 00:15:5d:19:76:00 txqueuelen 1000 (Ethernet)
RX packets 56234 bytes 311928403 (311.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 13927 bytes 1148583 (1.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
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:
sudo ifconfig eth0 mtu 1290
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