git commit错误-无法运行vim:无此类文件或目录


8
$ 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.

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


您要运行vim或其他编辑器吗?如果要运行vim,如果从命令行运行它,它是否可以工作?
吉尔(Gilles)“所以,别再邪恶了”

Answers:


13

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

$ git config --global core.editor nano

您还可以设置EDITOR环境变量,如果core.editor未设置git,它将重新使用:

$ export EDITOR=nano

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.