且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

git commit 弹出编辑器后报错: Aborting commit due to empty commit message.

更新时间:2021-10-17 06:16:16

使用终端提交代码 "git commit" 能正常弹出 设置的编辑器,但是直接被空消息提交上来导致无效。

git commit 弹出编辑器后报错: Aborting commit due to empty commit message.
git commit

使用了插件 # git-extras 简化命令
gc == git commit

解决方法: $ git config --global core.editor "subl -w -f"

"subl -f" 表示设置默认启动的编辑器,-w表示等待编辑器提交之后, -f 为一个参数 让它不要 fork。 mac 的时候使用 -w -f 其他好像只用 -w即可。
如果像设置其他编辑器直接将 subl 换成 编辑器在 .bin/ 里面的缩写即可。 如vim、nano 等等 。
或者直接 git commit "提交内容"。

参考:https://***.com/questions/9725160/aborting-commit-due-to-empty-commit-message