Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
JakubBizewski opened this issue Jun 5, 2020 · 18 comments
Closed

Comments

@JakubBizewski
Copy link

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.

@therealkenc
Copy link
Collaborator

image

@JakubBizewski
Copy link
Author

Well, all the sudden it started working again. But something similar happened yesterday. It didn't work for the majority of the day, even restarts of the WSL didn't help. Can someone look into the meaning of the error I was getting? I would appreciate if it didn't happen in the future.

@therealkenc
Copy link
Collaborator

therealkenc commented Jun 5, 2020

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.

@jdme
Copy link

jdme commented Jun 21, 2020

I have exactly the same behavior with WSL2.
This happens only with bitbucket.org and only from inside WSL2 (I tried ubuntu and debian)!
If I do the same thing from the windows cmd, everything is just fine.
2020-06-22_02-15-50

By the way, ping bitbucket.org command doesn't respond either from windows cmd or wsl2.

I've seen #4253, but I don't use Intel Wi-Fi card.

Also I tried to run it over an Ethernet - nothing changed, same result. So probably Wi-Fi driver is not relevant to this issue.

UPDATE 26/07/2020:
Now it's working fine finally. I have no idea what has been changed.

@Leozartino
Copy link

I had the same issue with WSL2, however when i use the personal hotspot through my iphone 11, the command "git clone" works without major problems, but I don't understand why this happens.

@palmlan
Copy link

palmlan commented Dec 29, 2021

I have the same problem, using git installed with ubuntu 20.04 wsl2 distrobution on win10pro, the "git clone" command may hang with some specific repo, but not always, and the stick point may vary, sometimes after the "POST git-upload-pack“ message,sometimes in the middle of "Counting objects:" message . Using git.exe for windows in wsl2 terminal has no such problem.

@zanetta
Copy link

zanetta commented Jan 19, 2022

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)

@fredowisk
Copy link

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!

@zanetta
Copy link

zanetta commented Mar 16, 2022

@fredowisk im glad it helped you :)

@cryptoprof
Copy link

@zanetta thank you! Had same promlem like @fredowisk

@dxp227
Copy link

dxp227 commented Apr 1, 2022

MTU update fixed me as well!

Worth noting that my issues started after setting up Docker.

@winuxue
Copy link

winuxue commented Apr 10, 2022

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

@dzmitry-lahoda
Copy link

Windows 11 WSL2 Ubuntu 20.04 Git, suggested workaround worked. Docker installed. Previously tried different repositories for dozen minutes.

@husain-zaidi
Copy link

The workaround worked for me.

@zanetta
Copy link

zanetta commented Feb 17, 2023

@zanetta thank you! Had same promlem like @fredowisk

nice!

@zanetta
Copy link

zanetta commented Feb 17, 2023

The workaround worked for me.

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

try to update for WSL2.

@robcornelius
Copy link

I am on WSL 2.3.26.0 with Ubuntu 24.04.1 and git 2.43.0

The work around in this doesn't work. It doesn't matter if I am on or off my company VPN.

This makes it impossible to clone repos. So there is little point in having WSL at all.

@zanetta
Copy link

zanetta commented Dec 12, 2024

I am on WSL 2.3.26.0 with Ubuntu 24.04.1 and git 2.43.0

The work around in this doesn't work. It doesn't matter if I am on or off my company VPN.

This makes it impossible to clone repos. So there is little point in having WSL at all.

Below are my specs. If you want to try with the same version would be nice. Later I will update my system and try it. But for now, its working perfectly nice.

----------------- CUT HERE --------------------

C:\Users\guilh>wsl --version
Versão do WSL: 2.3.26.0
Versão do kernel: 5.15.167.4-1
Versão do WSLg: 1.0.65
Versão do MSRDC: 1.2.5620
Versão do Direct3D: 1.611.1-81528511
Versão do DXCore: 10.0.26100.1-240331-1435.ge-release
Versão do Windows: 10.0.26100.2454

Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.167.4-microsoft-standard-WSL2 x86_64)

zanetta at natalie in ~
$ git --version
git version 2.34.1

---------------- CUT HERE -------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests