Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to fix the `error: bad fsmonitor version 2` in Windows Subsystem for Linux (WSL)?

I do have Git Bash installed (WSL2 is still very slow on large git repos like llvm and webkit). in WSL2 Ubuntu 20.04:

matt@Surface2:/mnt/c/Users/matt/src/roact-alignment$ git --version
git version 2.25.1

in cmd:

C:\Users\matt>git --version
git version 2.33.0.windows.1

even when no cmd is opened, I was getting this for git operations:

matt@Surface2:/mnt/c/Users/matt/src/roact-alignment$ git pull
error: bad fsmonitor version 2
error: bad fsmonitor version 2
like image 659
Matt Hargett Avatar asked Sep 23 '21 03:09

Matt Hargett


Video Answer


3 Answers

I solved this problem by upgrading git.

# Add ppa of git
sudo add-apt-repository ppa:git-core/ppa

# Update sources
sudo apt update

# Upgrade git
sudo apt upgrade

more details, see this Page

like image 51
叶芝秋 Avatar answered Oct 17 '22 09:10

叶芝秋


I think in newer VS Code, it has the win32 git client running. It appears that the linux git client connects to the win32 fsmonitor "service" somehow.

The solution was to update the version of git in WSL2 to be closer to the git.exe that was installed with Git Bash and/or Visual Studio Code.

I followed the instructions to add the updated git releases PPA for Ubuntu here: https://git-scm.com/download/linux

and the messages went away!

like image 21
Matt Hargett Avatar answered Oct 17 '22 08:10

Matt Hargett


fixed by upgrade git to 2.36.1 in WSL2

like image 1
Kimia Zhu Avatar answered Oct 17 '22 08:10

Kimia Zhu