visual-studio-code - 在 VSCode 中使用安装在 Windows Subsystem for Linux 中的 git

标签 visual-studio-code

我通过 WSL2 安装了 git:

Arch Linux on Windows 10 x86_64 with 4.19.84-microsoft-standard
 $ which git
/usr/sbin/git

cmd 中,我可以通过 wsl.exe git ... 或通过我创建的用于访问 wsl 程序的批处理文件来使用 git:

 > wsl git status
On branch next
...
 > git.bat status
On branch next
...

但是 git 不工作:

Looking for git in: C:\Program Files\Git\cmd\git.exe
Looking for git in: C:\Program Files (x86)\Git\cmd\git.exe
Looking for git in: C:\Program Files\Git\cmd\git.exe
Looking for git in: C:\Users\x\AppData\Local\Programs\Git\cmd\git.exe
Git installation not found.

到目前为止我尝试了什么:

  • 我将我的 git.bat 移到了 C:\Users\x\AppData\Local\Programs\Git\cmd\git.bat
  • 我在设置 json 中放置了一个明确的 git 路径:

    { “git.enabled”:是的, "git.path": "C:\Windows\System32\wsl.exe git", //...

哪个也不行:

Looking for git in: C:\Windows\System32\wsl.exe git
Looking for git in: C:\Program Files\Git\cmd\git.exe
Looking for git in: C:\Program Files (x86)\Git\cmd\git.exe
Looking for git in: C:\Program Files\Git\cmd\git.exe
Looking for git in: C:\Users\x\AppData\Local\Programs\Git\cmd\git.exe
Git installation not found.

如果我不想安装适用于 Windows 的 git 怎么办?

最佳答案

关于visual-studio-code - 在 VSCode 中使用安装在 Windows Subsystem for Linux 中的 git,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61215059/

相关文章:

unit-testing - 在 Visual Studio Code 编辑器中完全禁用 Jest 测试运行器的自动运行

node.js - 无法使用 babel-node 为 Node 启动 VSCode 调试器

python - 切换 git 分支后 Visual Studio Code Python IntelliSense 数据库不同步?

visual-studio-code - VSCODE 远程编辑,打开时下载选项?

python - 未检测到 Python 3.8 安装

node.js - 从 VS Code 将 NodeJS 应用部署到 Azure

docker - VS-code 在容器中重新打开 -> ERROR : . PermissionError: [Errno 13] Permission denied

python - VSCode - django 项目困惑的单元测试配置

git - 将 git 与 VS Code 连接

visual-studio-code - VSCode 扩展 : How do I open a new pane with an http url