![git 提交错误 - 无法运行 vim:没有这样的文件或目录](https://linux22.com/image/25657/git%20%E6%8F%90%E4%BA%A4%E9%94%99%E8%AF%AF%20-%20%E6%97%A0%E6%B3%95%E8%BF%90%E8%A1%8C%20vim%EF%BC%9A%E6%B2%A1%E6%9C%89%E8%BF%99%E6%A0%B7%E7%9A%84%E6%96%87%E4%BB%B6%E6%88%96%E7%9B%AE%E5%BD%95.png)
$ 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.
如何克服错误并定义编辑器?
答案1
vim
除了在命令行上安装或指定提交消息(如建议的错误消息)之外,还有多种方法可以告诉 git 应使用哪个编辑器。您可以设置该core.editor
属性(该项目的本地属性,或所有 git 的全局属性):
$ git config --global core.editor nano
您还可以设置环境变量,如果未设置,EDITOR
git 将依赖该环境变量:core.editor
$ export EDITOR=nano
答案2
答案是:
sudo apt-get install vim
因为是新机器,没有安装vim。