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?
当前回答
首先检查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
**只需添加一个双斜杠(\\),就像上面的代码一样。
其他回答
我发现在设置中有git: false。Json,并将其更改为true。现在起作用了。
对于基于linux的操作系统:由于路径损坏,我遇到了这样的问题,但我能够暂时修复这个问题,我的Git安装立即恢复。
如果您遇到这样的路径问题,请键入下面的命令
export PATH="/usr/bin:/bin:$PATH"
我只需要从这个链接https://git-scm.com/download/win为windows安装git就可以了
不需要设置环境变量或路径。
背景: 我已经安装了VS Code,和github桌面,我克隆的回购使用github桌面。
当我打开repo时,使用VS Code,我看到了这个错误。
我通过为windows安装git来解决这个问题。
之后又遇到了同样的问题!
我是怎么修好的?
步骤1:进入vscode中的设置。
步骤2:打开settings.json。
步骤3:你需要找到像“git. git.”在settings.json中的路径"
步骤4:只需在系统中添加安装git的目录路径。
例如:“git”。路径”:“D: / Git / bin / git.exe”
步骤5:重新启动vscode。
希望这能有所帮助。
现在,您可以配置Visual Studio Code(版本0.10.2,检查旧版本)以使用现有的Git安装。
只需在Visual Studio Code设置(菜单File→Preferences→settings)中添加Git可执行文件的路径,如下所示:
{
// Is Git enabled
"git.enabled": true,
// Path to the Git executable
"git.path": "C:\\path\\to\\git.exe"
// Other settings
}