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?
当前回答
我在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没有安装在您的系统上”错误。
其他回答
在将macOS升级到Monterey后,我遇到了这个问题。
原来xcode已经在我的mac的新更新中被删除了。只是尝试了以下建议的解决方案:
https://stackoverflow.com/a/52522566/11207358
以下是对我有效的方法。不要使用Visual Studio Code终端来运行Git命令,而是从应用程序路径下的cmd终端运行Git命令。
通过安装Git Lens Visual Code扩展,我在MacOS上用m1 pro处理器解决了同样的问题。启用扩展名后显示更改的文件。然后我重新加载VSCode,没有任何变化,但一旦我运行
git status
在终端中,显示所有的文件,并跟踪所有的更改。
对于基于linux的操作系统:由于路径损坏,我遇到了这样的问题,但我能够暂时修复这个问题,我的Git安装立即恢复。
如果您遇到这样的路径问题,请键入下面的命令
export PATH="/usr/bin:/bin:$PATH"
对于MAC
首先,类型
git
在终端中,看看你得到了什么错误。
然后:
如果错误与命令行工具有关!
Run:
xcode-select --install
And
我们来看看这个答案,尤其是Mac。对我来说很容易。
https://apple.stackexchange.com/a/254381