Git clone fails in WSL 2
Update your WiFi drivers
In the recent weeks I’ve been running into issues when cloning from remote Git repositories. Not just on Github.com, but elsewhere as well. Some repos would clone, others would fail with obscure messages. For a while no amount of Googling would lead me to a favorable result. Updating all of packages inside the WSL distro? Done. Updating OpenSSL and
ca-certificate packages? You got it. Still the same issues.
There’s two resources that ended up solving the issue:
The first one is in Japanese, which I definitely don’t understand. But command line is an universal language, and based on the pictures and commands from that post it seemed that by updating the network drivers on the writer’s machine solved the problem.
The second link had users complaining since 2019 of the same issue. Some user noted that when he switched from WiFi to Ethernet the problem went away !?!
So i then tried switching from wifi to ethernet, and the problem cleared up. Both machines have an Intel Wireless-AC9560 chipset. So there is something super wonky there
Definitely mysterious. The same user, CyrusNajmabadi later wrote on Jul 1, 2019 that updating his WiFi drivers solved the issue:
Ok. So updating my wifi chipset drivers fixed the issue. In case anyone else runs into the above, the drivers i updated to were found here: …
I’m not using an Intel chipset for my network card, so I had to hunt down the drivers for my chipset and install a newer version, which luckily was available at the Killer networking site.
After the drivers finished installing, the WiFi connection dropped and I re-established connection to my access point a few seconds later. I did not reboot my machine, Docker, or WSL 2.
Then I tested cloning the Git repository that was failing before and it just …worked!?!?!
Here’s the error before and after (fixed) on Alpine WSL 2:
The same use case on Ubuntu WSL 2:
As you can see on the Ubuntu screenshot, some repositories would fail (Lando, for example); but other repositories (WSL on Github) would clone without issues.
Here is Ubuntu WSL 2 cloning the (previously failing) same repository without as much as a fuss:
Some other users on WSL issue #4253 also complained about having to adjust their MTU, especially when using VPNs (for example, Global Protect). Luckily that wasn’t the case for me, but I’ll just leave a note here just in case $#@* forbid someday it becomes one.