git commit 错误 - 无法运行 vim:没有这样的文件或目录

Mic*_*ant 8 git vi

$ git commit  
error: cannot run vim: No such file or directory
error: There was a problem with the editor 'vim'.
Please supply the message using either -m or -F option.
Run Code Online (Sandbox Code Playgroud)

如何克服错误并定义编辑器?

Mic*_*zek 13

除了vim像建议的错误消息一样在命令行上安装或指定提交消息之外,还有几种方法可以告诉 git 它应该使用哪个编辑器。您可以设置core.editor属性(针对该项目在本地,或针对所有 git 全局设置):

$ git config --global core.editor nano
Run Code Online (Sandbox Code Playgroud)

您还可以设置EDITOR环境变量,如果core.editor未设置,git 将依赖该变量:

$ export EDITOR=nano
Run Code Online (Sandbox Code Playgroud)


Mic*_*ant 5

答案是:

sudo apt-get install vim
Run Code Online (Sandbox Code Playgroud)

因为它是一台新机器并且没有安装 vim。