我试着执行 git commit
,但是Git给出了以下提示:
提示:等待编辑器关闭文件... /c/Users/AGT/AppData/Local/Programs/Microsoft VS Code/bin/code: line 28: /Code.exe: 没有那个文件或目录 错误:使用 -m 或 -F 选项指定提交信息。
我尝试将VS Code设置为默认编辑器,无论它是打开的还是关闭的,都得到了同样的消息。通过VS Code或命令 git commit -m "Initial commit"
进行的提交可以正常工作。
我尝试使用以下命令来更改配置路径:
git config --global core.editor "code --wait"
git config --global core.editor "'C:\Users\AGT\AppData\Local\Programs\Microsoft VS Code\Code.exe' -n -w"
以及后面的变体(这些变化在错误消息中带有“unexpected EOF while looking for matching”):- C:\Users\AGT\AppData\Local\Programs\Microsoft VS Code\bin
- C:\Users\AGT\AppData\Local\Programs\Microsoft VS Code\bin\code
- C:\Users\AGT\AppData\Local\Programs\Microsoft VS Code\Code.exe
但都没有成功。
此时的 git 状态如下:
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: css/app.css
new file: index.html
new file: js/app.js
如何修复在Git BASH中使用git commit
命令时在Vs Code中无法正常工作的问题?这似乎是路径问题。
更新信息:我已经测试了在Sublime 3中使用git commit
,它可以正常工作。