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,它工作了!

brew install git

其他回答

之后又遇到了同样的问题!

我是怎么修好的?

步骤1:进入vscode中的设置。

步骤2:打开settings.json。

步骤3:你需要找到像“git. git.”在settings.json中的路径"

步骤4:只需在系统中添加安装git的目录路径。

例如:“git”。路径”:“D: / Git / bin / git.exe”

步骤5:重新启动vscode。

希望这能有所帮助。

对于MAC

首先,类型

git

在终端中,看看你得到了什么错误。

然后:

如果错误与命令行工具有关!

Run:

xcode-select --install

And

我们来看看这个答案,尤其是Mac。对我来说很容易。

https://apple.stackexchange.com/a/254381

以下是对我有效的方法。不要使用Visual Studio Code终端来运行Git命令,而是从应用程序路径下的cmd终端运行Git命令。

在将macOS更新到Ventura后,我也遇到了同样的问题!

我使用下面的命令,它为我工作!

git --version

确认你是否已经安装了git,如果没有运行

brew install git

安装最新版本。

安装成功后,运行

brew link git

如果它不能符号链接,因为目标已经存在,你可以运行

brew link --overwrite git

覆盖它。

希望这对你有用!

Visual Studio Code只是在PATH中查找git。为了简单起见,许多UI客户端附带了“可移植Git”,并且没有将Git添加到路径中。

如果您将现有的git客户端添加到您的PATH(以便它可以找到git.exe), Visual Studio Code应该启用git源代码控制管理。