提交 git 时出现 Vi 错误

Vi Error while making git commit

我正在尝试进行 git 提交。我 运行 命令 git commit 和 vim 打开。我输入我的提交消息,当我执行 :wq 命令时,我收到以下错误:

error: There was a problem with the editor 'vi'. Please supply the message using either -m or -F option.

知道如何找出问题所在吗?

要解决此问题,请更改您的 git 编辑器路径

git config --global core.editor /usr/bin/vim 

SOURCE

如果你想恢复提交信息,你可以查看.git/COMMIT_EDITMSG

This file contains the commit message of a commit in progress. If git commit exits due to an error before creating a commit, any commit message that has been provided by the user (e.g., in an editor session) will be available in this file, but will be overwritten by the next invocation of git commit.