如何修复 Windows Subsystem for Linux (WSL) 中的“错误:错误的 fsmonitor 版本 2”?

Mat*_*ett 14 git visual-studio-code windows-subsystem-for-linux wsl-2

我确实安装了 Git Bash(WSL2 在大型 git 存储库(如 llvm 和 webkit)上仍然非常慢)。在 WSL2 Ubuntu 20.04 中:

matt@Surface2:/mnt/c/Users/matt/src/roact-alignment$ git --version
git version 2.25.1
Run Code Online (Sandbox Code Playgroud)

在命令中:

C:\Users\matt>git --version
git version 2.33.0.windows.1
Run Code Online (Sandbox Code Playgroud)

即使没有打开 cmd,我也会得到这个 git 操作:

matt@Surface2:/mnt/c/Users/matt/src/roact-alignment$ git pull
error: bad fsmonitor version 2
error: bad fsmonitor version 2
Run Code Online (Sandbox Code Playgroud)

小智 26

我通过升级git解决了这个问题。

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

# Update sources
sudo apt update

# Upgrade git
sudo apt upgrade
Run Code Online (Sandbox Code Playgroud)

更多详情,请参阅此页面


Mat*_*ett 8

我认为在较新的 VS Code 中,它运行着 win32 git 客户端。看来 linux git 客户端以某种方式连接到 win32 fsmonitor“服务”。

解决方案是更新 WSL2 中的 git 版本,使其更接近与 Git Bash 和/或 Visual Studio Code 一起安装的 git.exe。

我按照说明在此处添加了适用于 Ubuntu 的更新的 git 版本 PPA: https: //git-scm.com/download/linux

然后消息就消失了!