Visual Studio代码无法识别git [英] Visual Studio Code does not recognize git
问题描述
我刚刚将VS Code更新为v.1.19.0,突然发现git无法识别.我仍然可以从终端(cmd)窗口执行所有操作,但是Source Control选项卡为空,并且显示找不到Git.请安装它或使用'git.path'设置进行配置" .
I just updated VS Code to v.1.19.0 and suddenly git is not recognized. I can still perform everything from the terminal (cmd) window, but the Source Control tab is empty and I get "Git not found. Install it or configure it using 'git.path' setting".
这是我在输出"控制台中看到的内容:
This is what I see in the Output console:
Looking for git in: C:\Users\UserName\AppData\Local\Programs\Git\cmd
Looking for git in: C:\Program Files\Git\cmd\git.exe
Looking for git in: C:\Program Files (x86)\Git\cmd\git.exe
Looking for git in: C:\Program Files\Git\cmd\git.exe
在我的设置中,我有:
"git.path": "C:\\Users\\UserName\\AppData\\Local\\Programs\\Git\\cmd"
指向git.exe的位置
which points to the location of git.exe
我不确定为什么,但是当我安装Git时,它将其放置在AppData文件夹中,而不是在Program Files中.无论如何,直到今天早上安装更新为止,一切都工作正常.
I am not sure why, but when I installed Git it placed it in the AppData folder instead of in Program Files. Regardless, everything was working fine until this morning when I installed the update.
如果有帮助,我正在使用Windows 10 64位操作系统和git版本2.15.1.windows.2的Windows机器上.
If it helps, I am on a windows machine with Windows 10 64-bit OS and git version 2.15.1.windows.2 .
有什么想法为什么VS Code没看到吗?
Any idea why VS Code is not seeing it?
推荐答案
尝试设置git.exe
而不是父文件夹:
Try setting git.exe
instead of the parent folder:
"git.path": "C:\\Users\\UserName\\AppData\\Local\\Programs\\Git\\cmd\\git.exe"
这是我在自己的VSCode用户设置中需要的:
This is what I needed in my own VSCode User settings:
这篇关于Visual Studio代码无法识别git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!