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?


当前回答

这可能发生在升级macOS之后。试着在终端上运行Git,看看错误信息是否以:

xrun: error: invalid active developer path (/Library/ developer /CommandLineTools)…

如果是这样,修复是运行:

xcode-select——安装

在终点站。更多细节请看这个答案。

其他回答

更新2020 (Mac)

我经过了这个$h!†再次更新到macOS v10.15 (Catalina),这需要Xcode更新。

要澄清的是,虽然这篇文章是关于Visual Studio代码的,但这个问题是系统范围内的。Git安装受到影响。你可以试着在你的终端、Bash、Z shell (zsh)或其他工具中运行git。现在是,以后也不会了。

这是同样的方法。更新Xcode即可。启动它并同意许可。就是这样。


我在Mac/OS X上打了这个。

症状:

你已经使用Visual Studio Code一段时间了,Git没有任何问题 你安装Xcode(不管什么原因-操作系统更新等) 在安装Xcode后,Visual Studio Code突然“找不到Git,并要求你在设置中安装或设置路径”

快速修复:

运行Xcode(安装后第一次)并同意许可。就是这样。

我是如何偶然发现这个“解决方案”的:

在经历了许多关于检查git的技巧后,例如,哪个git和git——版本,后者实际上提供了以下终端消息的线索:

同意Xcode/iOS许可证需要管理员权限,请运行" sudo xcodebuild -license ",然后重试此命令。

至于为什么Xcode会把它的手放在git上,WAT。

运行 它会提示你安装命令行开发工具。安装工具并重新启动VScode。 你会在VScode中再次看到git工作

在将macOS升级到Monterey后,我遇到了这个问题。

原来xcode已经在我的mac的新更新中被删除了。只是尝试了以下建议的解决方案:

https://stackoverflow.com/a/52522566/11207358

我在Windows 8.1系统下工作的唯一方法是: 添加到系统环境变量(不是用户变量):

c:\Users\USERNAME\AppData\Local\GitHub\ PortableGit_YOURVERSION \ bin \; c: \ \用户名\ AppData \用户本地\ GitHub \ PortableGit_YOURVERSION \ libexec \ git-core \;当地用户c: \ \用户名\ AppData \ \ GitHub \ PortableGit_YOURVERSION \ cmd \

这修复了我的Visual Studio代码上的“看起来git没有安装在您的系统上”错误。

我最近开始使用Visual Studio Code。我有这个问题,只是写Git可执行文件的确切路径解决 这个问题。代码如下:

“git。C:\Program Files\Git\bin\ Git .exe