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?
当前回答
Visual Studio Code只是在PATH中查找git。为了简单起见,许多UI客户端附带了“可移植Git”,并且没有将Git添加到路径中。
如果您将现有的git客户端添加到您的PATH(以便它可以找到git.exe), Visual Studio Code应该启用git源代码控制管理。
其他回答
Make sure git is enabled (File --> Preferences --> Git Enabled) as other have mentioned. Make sure Gits installed and in the PATH (with the correct location, by default: C:\Program Files\Git\cmd) - PATH on system variables btw Change default terminal, Powershell can be a bit funny, I recommend Git BASH but cmd is fine, this can be done by selecting the terminal dropdown and selecting 'set default shell' then creating a new terminal with the + button. Restarting VS Code, sometimes Reboot if that fails.
希望这对你有所帮助,最后但并非最不重要的是,它是'git'而不是'git' /'gat'。:)
之后又遇到了同样的问题!
我是怎么修好的?
步骤1:进入vscode中的设置。
步骤2:打开settings.json。
步骤3:你需要找到像“git. git.”在settings.json中的路径"
步骤4:只需在系统中添加安装git的目录路径。
例如:“git”。路径”:“D: / Git / bin / git.exe”
步骤5:重新启动vscode。
希望这能有所帮助。
在更新macOS后遇到了这个问题!
再次使用自制软件安装git,它工作了!
brew install git
Visual Studio Code只是在PATH中查找git。为了简单起见,许多UI客户端附带了“可移植Git”,并且没有将Git添加到路径中。
如果您将现有的git客户端添加到您的PATH(以便它可以找到git.exe), Visual Studio Code应该启用git源代码控制管理。
这样做:
1. File > Preferences > setting
2. In search type -> git path
3. Now scroll down a little > you will see "Git:path" section.
4. Click "Edit in settings.json".
5. Now just paste this path there "C:\\Program Files\\Git\\mingw64\\libexec\\git-core\\git.exe"
重启VSCode,在VSCode中打开新终端,尝试“git版本”
如果仍然存在问题:
1. Inside terminal click on terminal options (1:Poweshell)
2. Select default shell
3. Select bash
打开新终端,并将终端选项改为2:Bash 再次尝试“git版本”-这应该工作:)