Visual Studio Code reports "It look like git is not installed on your system." when I try to switch to the git view. I know I have git installed and used by other Git clients. I guess if I reinstall Git following Visual Studio Code's instruction ("install it with Chocolatey or download it from git-scm.com"), it probably can fix the problem, but I don't want to mess up the existing Git clients on my system. Is there a reliable way to configure Visual Studio Code so it can find existing git installation?
当前回答
三年后,我遇到了同样的问题。在用户设置& path环境变量中设置路径没有帮助。我更新了Visual Studio Code,这就解决了问题。
其他回答
Visual Studio Code只是在PATH中查找git。为了简单起见,许多UI客户端附带了“可移植Git”,并且没有将Git添加到路径中。
如果您将现有的git客户端添加到您的PATH(以便它可以找到git.exe), Visual Studio Code应该启用git源代码控制管理。
在将macOS升级到Monterey后,我遇到了这个问题。
原来xcode已经在我的mac的新更新中被删除了。只是尝试了以下建议的解决方案:
https://stackoverflow.com/a/52522566/11207358
Windows 10操作系统:
我的问题是我在管理模式下使用PowerShell克隆了存储库。当我不在管理模式下启动PowerShell时,VS Code可以检测到Git回购。
我在升级到macOS v10.15 (Catalina)后遇到了这个问题。
问题解决方法如下:
1.
从终端找到Git的位置:
which git
2.
在设置文件中添加Git的位置和你的位置:
settings.json
"git.path": "/usr/local/bin/git",
根据你的平台,用户设置文件(settings.json)位于这里: Windows % APPDATA % \ \用户\ settings.json代码 macOS $HOME/Library/Application Support/Code/User/settings.json Linux $ HOME / config /代码/ User / settings.json
首先在桌面上安装Git,然后在Visual Studio Code中添加包围的扩展,如图所示。
帮我解决了和你一样的问题。