VSCode中安装了GitLens 发现报这个错:
GitLens was unable to find Git. Please make sure Git is installed. Also ensure that Git is either in the PATH, or that 'gitlens.advanced.git' is pointed to its installed location
可能原因是setting中没有添加git的地址,找到如下截图所示的setting
image.png
输入git.path快速查找
image.png
将下面git的地址加入git.path
{
// Is git enabled
"git.enabled": true,
// Path to the git executable
"git.path": "C:/git_install/Git/bin/git.exe",
"git.autofetch": true
}
然后重新打开VSCode发现不会再报错了。
初始化git项目,在terminal输入git init ,报错:
无法将“git”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
可能原因是你没有将git的安装路径添加到系统的环境变量中。
解决办法:
打开编辑系统环境变量设置,将bin和git.exe的目录添加到PATH中,如图所示:
681eb9942a70119030a4874749ef281.png
保存后发现一切可以正常使用啦。
要根据自己的实际情况debug。
网友评论