WSL: Git and gnutls_handshake() failed: Error in the pull function errror

Environment

Windows build number: 10.0.19041.264
Your Distribution version: Ubuntu-20.04
Whether the issue is on WSL 2 and/or WSL 1: WSL 2

Steps to reproduce

Use git clone with HTTPS url or git push in already existing repo, using HTTPS. The remote repo I am trying to use is hosted on bitbucket.org.

I don’t use any antivirus besides Windows Defender. My firewall is on. I am connected to the Internet using an Ethnernet wire (Killer E2200 NIC).

Expected behavior

Successful clone or push to the remote. An authorization message should appear asking for my password (username is provided in the remote’s URL).

Actual behavior

The process hangs for a few minutes and then quits with message:

unable to access ‘https://bitbucket.org/org/project.git/’: gnutls_handshake() failed: Error in the pull function.

Here’s what I gathered using GIT_TRACE_PACKET=1 GIT_TRACE=1 GIT_CURL_VERBOSE=1: image

When I try to clone the same repo on Windows, it works just fine.

I’ve seen #4253, but I don’t use Intel Wi-Fi card. #3647 also doesn’t seem to apply, I only use Windows Defender.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 19

Most upvoted comments

Hello people,

The problem was in a mismatch between VPN MTU and Linux under WSL2 MTU sizes.

It can be identified via 2 commands:

Windows PowerShell (run as administrator)

netsh interface ipv4 show subinterfaces

Notice the first row - it shows how big MTU is allowed in your VPN.

Linux (inside WSL2) console

ip addr

Notice the row starting ‘eth0’ - its MTU must match or be lower that the one above.

In my case the MTU in Linux was higher.

Solution

The following command instantly solves the problem:

sudo ip link set dev eth0 mtu 1400 (update MTU value to fit your VPN)

I have put it inside my ~/.bashrc and put /usr/sbin/ip into sudoers NOPASSWD for my account. (credit: https://serverfault.com/questions/1059522/meraki-vpn-behind-nat-breaks-bitbucket-git-on-wsl2-ubuntu-20-on-windows-10)

Can someone look into the meaning of the error I was getting

That much rhetorical (yes) because of “can” and “someone” qualifiers. Whether you could find someone on the Interwebs (serverfault, stackoverflow, reddit, bitbucket forums, git forums, gnu tls mailing list, etc etc etc) to drill down that error message for you absent a repro is probably pretty small, but you might get lucky. If you manage to narrow the problem to a WSL actionable please open a new issue with the details.

Thanks @zanetta, I didn’t use VPN, my eth0 in Linux was lower, but the command ‘sudo ip link set dev eth0 mtu 1400’ solved the problem! Thank you so much!

On Ubuntu 22.04.5 when I wanted to git pull from remote, after a long time it returned error:

fatal: unable to access ‘path/to/repo.git/’: gnutls_handshake() failed: Error in the pull function.

I changed mtu to 1400 but didn’t work. Then, changed to 1350 and problem solved.

sudo ip link set <dev> mtu 1350

MTU update fixed me as well!

Worth noting that my issues started after setting up Docker.

I’m trying with sudo ip link set dev wifi0 mtu 1400 but after run ip addr again, it is still in 1500

Tested using Windows 11 + wsl1 + ubuntu 20.04

@zanetta thank you! Had same promlem like @fredowisk