Git 使用编辑器提交错误终端

Git Commit Error terminal with the editor

我在使用命令 git commit 时遇到了一些问题。我做了一个 git commit 但不幸的是我按下了 Ctrl+Z 而不是 Ctrl+X 来关闭,所以现在当我再次 git commit 时,它给了我这个错误:

error: editor died of signal 11
                           error: There was a problem with the editor 'editor'.   `Please, specific the message using option -m or -F. `

其实我不知道如何解决这个错误。 我 运行 的操作系统是 Ubuntu 15.10.

确保您已完成 git add <files>git rm <files> 然后尝试使用 git commit -m "<commit message>" 而不是打开编辑器。

试试这个:- 这是为了跳过暂存并提交

git commit -a -m "message"

删除或添加任何文件后,使用此命令提交:-

git commit -m "message"

您似乎在使用 nano 编辑器。当您点击 Ctrl+Z 时,您暂停了编辑器 something that seems to happen

现在 git 告诉您您的编辑器坏了。尝试通过输入 fg 唤醒 nano 或使用 killall nano.

终止进程

请使用此命令为 git 设置默认编辑器 git 配置 --global core.editor "vim"

这里我设置了Vim编辑器。它会解决你的问题。

  1. 转到 .git/ 文件夹
  2. 删除文件.COMMIT_EDITMSG.swp

您的 EDITOR 变量很可能已被删除或重置。为避免现在和将来出现一般问题,请在 .zshrc.bashrc

中进行设置

export EDITOR=$(which vim)