Git提交时关于vim的错误

982 阅读1分钟

在 Git Bash 中使用 Vim 提交时,会报错,详情如下:

$ git commit -v
Error: There was a problem with the editor 'vim'. 
Please supply the message using either -m or -F option.

解决方案:

搜索 stackoverflow 时,发现很多人提到了设置:

git config --global core.editor "vim" 

但很可惜,It doesn't work for me ~ 依然会报错。

最终,看到相关帖受到了启发,想起之前使用 Vim 时曾经没有正常保存退出,并直接中断进程的经历,所以参考如下链接中的办法,.git文件夹中找到 COMMIT_EDITMSG.swp 文件,并删除,就成功解决了这个问题。: )

参考链接:

Errors using Vim for commit