当我尝试在VS Code上使用Error: spawn git ENOENT
查看git历史记录时,我得到错误https://github.com/DonJayamanne/gitHistoryVSCode。我是VS Code和github的新手。我尝试使用谷歌搜索解决方案,但我只找到了关于node.js的链接,我完全不明白。
我们需要to install Git在VS Code中使用Git History(git log)扩展。
否则我们会在运行git log
时看到这个。
如果您已经安装了Git,那么请确保它可以从shell中获得,例如输入git --version
。
一旦正确安装了Git,您将在运行git log
时看到这一点。
我在MacOS上遇到了同样的问题(运行VS Cod 1.26.1)。与我找到的其他信息不同,我只是在设置之后才工作:
"git.path": "/usr/local/bin/git"
没有成功将路径设置为null或任何其他路径。
这意味着你需要在系统中为git
设置环境变量。设置好后,问题就会消失。
如果您的OS
是Windows:
尝试在系统命令行中键入“git --version”(不要错误地使用git bash
)。如果您看不到版本,则表示git
未添加到环境变量中。
例如,我的Git
安装在磁盘“C:\”上,我需要将“C:\ Program Files \ Git”添加到environment variables
的路径中。
方法1:
脚步:
编辑环境变量 - >系统变量
编辑Path
,添加
;C:\Program Files\Git\bin\git.exe;C:\Program Files\Git\cmd;
到Path
的当前值(如果多余则删除开头的;
)。
您需要根据安装git的实际目录调整此文件路径。
然后重新启动命令行,然后再次尝试键入“git --version”。如果您现在可以看到python版本,请再次尝试您的vs代码,您提到的问题将消失。
另一种方法:
通过检查"Add to PATH (available after restart)"
重新安装visual studio代码。
安装git,然后运行git init
如果您从使用Create React App创建的React应用程序中收到此错误,例如。 create-react-app nameOfYourApp
,你需要设置CircleCI环境。更多信息在这里https://facebook.github.io/create-react-app/docs/running-tests
在你自己的环境中
Vindovs(短信)
set CI=true&&npm test
set CI=true&&npm run build
(注意:缺少空格是故意的。)
Windows(Powershell)
($env:CI = "true") -and (npm test)
($env:CI = "true") -and (npm run build)
Linux,macOS(Bash)
CI=true npm test
CI=true npm run build