Search code examples
gitvisual-studio-codewindows-subsystem-for-linux

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

Solution

  • 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!