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工作
其他回答
在将macOS更新到Ventura后,我也遇到了同样的问题!
我使用下面的命令,它为我工作!
git --version
确认你是否已经安装了git,如果没有运行
brew install git
安装最新版本。
安装成功后,运行
brew link git
如果它不能符号链接,因为目标已经存在,你可以运行
brew link --overwrite git
覆盖它。
希望这对你有用!
我只需要从这个链接https://git-scm.com/download/win为windows安装git就可以了
不需要设置环境变量或路径。
背景: 我已经安装了VS Code,和github桌面,我克隆的回购使用github桌面。
当我打开repo时,使用VS Code,我看到了这个错误。
我通过为windows安装git来解决这个问题。
Visual Studio Code只是在PATH中查找git。为了简单起见,许多UI客户端附带了“可移植Git”,并且没有将Git添加到路径中。
如果您将现有的git客户端添加到您的PATH(以便它可以找到git.exe), Visual Studio Code应该启用git源代码控制管理。
我在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没有安装在您的系统上”错误。
VSCode 1.50(2020年9月)在问题85734中添加了一个有趣的替代方案:
Support multiple values for the git.path setting I use VSCode in three different places; my home computer, my work computer, and as a portable version I carry on a drive when I need to use a machine that doesn't have it. I use an extension to keep my settings synced up between editors, and the only issue I've encountered so far is that the git path doesn't match between any of them. On my home machine I have it installed to C of course, work likes to be funny and install it on A, and for the one on my drive I have a relative path set so that no matter what letter my drive gets, that VSCode can always find git. I already attempted to use an array myself just to see if it'd work: "git.path": ["C:\\Program Files\\Git\\bin\\git.exe", "A:\\Git\\bin\\git.exe", "..\\..\\Git\\bin\\git.exe"], But VSCode reads it as one entire value. What I'd like is for it to recognize it as an array and then try each path in order until it finds Git or runs out of paths.
这是通过PR 85954和提交c334da1解决的。
使用VSCode 1.60+
“git。启用”:真正的 git.path