VSCode 移动安装后未使用 wsl2 git

VSCode not using wsl2 git after moving installs

我 运行 Ubuntu-20.0.4 和 docker Windows 10 Pro 上的 WSL2 桌面。我最近使用 export/import 将发行版移动到另一个驱动器上,通过首先取消注册发行版来保持相同的名称。除了 git.

之外,一切都按预期工作

Git 使用集成 shell 工作正常,但在尝试通过 ide 提交时提示我添加全局配置。这让我相信它没有使用遥控器 git。我如何验证这一点,是否有任何修复?

This leads me to believe that it is not using the remote git

然后您可以打开 VSCode 设置,并在 Git Path 下放置您希望它使用的 git 的完整路径。

这样,独立于 VSCode 在 运行 时继承的 $PATH,表示 IDE 将使用您需要的确切 Git。


您还必须检查 VSCode 是哪个帐户 运行,否则它会访问 错误的“全局”设置(即来自另一个 帐户)。

OP Romski adds in :

I noticed that files created in VSCode were owned by root.
The fix was to set the default user <distribution> config --default-user <username>. I