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?


当前回答

如果git在操作系统更新后丢失,在我的大苏尔的情况下,只是字面上:brew install git

其他回答

我发现在设置中有git: false。Json,并将其更改为true。现在起作用了。

在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代码。

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'。:)

运行 它会提示你安装命令行开发工具。安装工具并重新启动VScode。 你会在VScode中再次看到git工作

通过安装Git Lens Visual Code扩展,我在MacOS上用m1 pro处理器解决了同样的问题。启用扩展名后显示更改的文件。然后我重新加载VSCode,没有任何变化,但一旦我运行

git status

在终端中,显示所有的文件,并跟踪所有的更改。