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(版本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
}
其他回答
在Visual Studio Code中,打开“用户设置”:Ctrl + P并输入>set。按回车。
这将在左侧打开默认设置,在右侧打开用户设置。
只需要在用户设置中添加git.exe的路径:
"git.path": "C:\\Users\\[WINDOWS_USER]\\AppData\\Local\\Programs\\Git\\bin\\git.exe"
用你的用户名替换[WINDOWS_USER]。
重新启动Visual Studio代码。
我发现在设置中有git: false。Json,并将其更改为true。现在起作用了。
现在,您可以配置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
}
在将macOS升级到Monterey后,我遇到了这个问题。
原来xcode已经在我的mac的新更新中被删除了。只是尝试了以下建议的解决方案:
https://stackoverflow.com/a/52522566/11207358
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错误。因为它们都是在路径中定义的,如果一个失败了,其余的也会失败。
推荐文章
- 打开同一目录两次
- 如何从终端/命令行调用VS代码编辑器
- 为什么我需要显式地推一个新分支?
- 如何撤消最后的git添加?
- Rubymine:如何让Git忽略Rubymine创建的.idea文件
- Gitignore二进制文件,没有扩展名
- Git隐藏错误:Git隐藏弹出并最终与合并冲突
- 了解Git和GitHub的基础知识
- 没有。Git目录的Git克隆
- Git与Mercurial仓库的互操作性
- 忽略git中修改(但未提交)的文件?
- “git restore”命令是什么?“git restore”和“git reset”之间有什么区别?
- Git合并与强制覆盖
- 如何在Visual Studio代码中重置设置?
- Git拉另一个分支