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?
当前回答
我只需要从这个链接https://git-scm.com/download/win为windows安装git就可以了
不需要设置环境变量或路径。
背景: 我已经安装了VS Code,和github桌面,我克隆的回购使用github桌面。
当我打开repo时,使用VS Code,我看到了这个错误。
我通过为windows安装git来解决这个问题。
其他回答
Open
C:\Users\nassim\AppData\Roaming\Code\User\settings.json
注释任何Git行:
// ...
// "git-graph.integratedTerminalShell": "E:\\Apps\\Git\\bin\\bash.exe",
// "git.path": ""
//...
将“git.exe”添加到操作系统路径下。
注意:修复这个Git错误也修复了npm错误。因为它们都是在路径中定义的,如果一个失败了,其余的也会失败。
这可能发生在升级macOS之后。试着在终端上运行Git,看看错误信息是否以:
xrun: error: invalid active developer path (/Library/ developer /CommandLineTools)…
如果是这样,修复是运行:
xcode-select——安装
在终点站。更多细节请看这个答案。
WINDOWS 10
没有什么能帮我摆脱困境。
问题出现在IntelliJ Idea和VSCode中。
VSCode中的Git选项卡让我Init存储库-它没有检测到工作区中有一个. Git文件夹。
当我在VSCode中从控制台执行git拉时,它要求我通过web浏览器添加凭据。在我登录后,git问题被修复,所有的插件开始工作。 我需要为每个克隆的存储库这样做,即使我在git克隆期间使用了正确的凭据…命令。
Ps.我在Windows上使用CMD通过HTTPS从Gitlab克隆了存储库。VScode使用Powershell -这可能是原因。
对我来说有用的是在我的系统中手动添加路径变量。
我遵循了这篇文章中的方法3:
https://appuals.com/fix-git-is-not-recognized-as-an-internal-or-external-command/
对于基于linux的操作系统:由于路径损坏,我遇到了这样的问题,但我能够暂时修复这个问题,我的Git安装立即恢复。
如果您遇到这样的路径问题,请键入下面的命令
export PATH="/usr/bin:/bin:$PATH"