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?


当前回答

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

其他回答

我只需要从这个链接https://git-scm.com/download/win为windows安装git就可以了

不需要设置环境变量或路径。

背景: 我已经安装了VS Code,和github桌面,我克隆的回购使用github桌面。

当我打开repo时,使用VS Code,我看到了这个错误。

我通过为windows安装git来解决这个问题。

三年后,我遇到了同样的问题。在用户设置& path环境变量中设置路径没有帮助。我更新了Visual Studio Code,这就解决了问题。

Windows 10操作系统:

我的问题是我在管理模式下使用PowerShell克隆了存储库。当我不在管理模式下启动PowerShell时,VS Code可以检测到Git回购。

首先检查Git*是否安装在你的系统中,在cmd /命令提示符中输入命令(在Windows中):

where git

如果你得到这样的输出,

λ where git
C:\cmder\vendor\git-for-windows\cmd\git.exe

然后进入设置→首选项→设置,把下面的代码**放在右边。

 {
    // If git enabled?
    "git.enabled": true,

    // Path to the Git executable
    "git.path": "C:\\cmder\\vendor\\git-for-windows\\cmd\\git.exe"
}

如果您没有安装Git,请从https://git-scm.com/安装Git

**只需添加一个双斜杠(\\),就像上面的代码一样。

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

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

git --version

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

brew install git

安装最新版本。

安装成功后,运行

brew link git

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

brew link --overwrite git

覆盖它。

希望这对你有用!