注意路径不能有空格和 .
,一开始安装路径为 D:\MinGW\msys\2.0\usr\bin
,会报错 exit code 2
,表示找不到文件1)
配置2):
"terminal.integrated.shell.windows": "D:\\msys64\\msys2_shell.cmd", "terminal.integrated.shellArgs.windows": ["-defterm", "-mingw64", "-no-start", "-here"],
上面配置换一个msys2
版本可能就不能用了,可以试试下面的配置
{ "terminal.integrated.shell.windows": "D:\\msys64\\usr\\bin\\bash.exe", "terminal.integrated.shellArgs.windows": ["-l"], "terminal.integrated.env.windows": { "CHERE_INVOKING": "1", "MSYSTEM": "MINGW64", } }
直接使用 会提示 没有活动的源代码控制提供程序,参见3)
@echo off setlocal rem If you don't add path for msys2 into %PATH%, enable following line. set PATH=d:\msys64\usr\bin;%PATH% if "%1" equ "rev-parse" goto rev_parse git %* goto :eof :rev_parse for /f %%1 in ('git %*') do cygpath -w %%1
附:VS Code 完整设置
{ "terminal.integrated.shell.windows": "D:\\msys64\\usr\\bin\\bash.exe", "terminal.integrated.shellArgs.windows": ["-l"], "terminal.integrated.env.windows": { "CHERE_INVOKING": "1", "MSYSTEM": "MINGW64", }, "git.postCommitCommand": "push", "git.path": "D:\\msys64\\git-vscode.bat", "editor.insertSpaces": false, "editor.detectIndentation": false, "editor.wordWrap": "on", "editor.snippetSuggestions": "top", "editor.tabCompletion": "on", "pangu.auto_format_on_save": true, "go.formatTool": "gofmt", "go.useLanguageServer": true, "terminal.integrated.automationShell.windows": "", }