简体   繁体   English

Git-commit无法打开vim

[英]Git-commit unable to open vim

Recently I installed bash-it into my terminal. 最近我把bash-it安装到了我的终端。 Now, when I try to execute git commit the terminal shows me this error: 现在,当我尝试执行git commit ,终端显示了这个错误:

/usr/bin/mate -w: /usr/bin/mate: No such file or directory error: cannot run /usr/bin/mate -w: No such file or directory error: There was a problem with the editor '/usr/bin/mate -w'. Please supply the message using either -m or -F option.

Before bash-it , the commit command correctly opened vim. bash-it之前,commit命令正确打开了vim。 Of course I've tried to change the core.editor in git to "vim" but it does not work anyway. 当然我试图将git中的core.editor更改为“vim”,但它无论如何都不起作用。

Could you please help me to solve this? 你能帮我解决这个问题吗? I really like vim, it was super easy and fast...I don't want to use TextMate to edit the commit message. 我非常喜欢vim,它非常简单快速...我不想使用TextMate来编辑提交消息。

PS: I'm using Mac OSX PS:我正在使用Mac OSX

Try using the below command. 尝试使用以下命令。 Should be able to set your editor back to vi or vim. 应该能够将编辑器设置回vi或vim。 However, you might have to give the absolute path to vim. 但是,您可能必须提供vim的绝对路径。

git config --global core.editor vim

如果其他答案不起作用,请尝试export GIT_EDITOR=vim

As "abalos" answered, 当“abalos”回答时,

git config --global core.editor vim

If you do not want to use vim or you do not have vim installed in some case, You can also use nano editor 如果您不想使用vim或者在某些情况下没有安装vim ,您也可以使用nano编辑器

git config --global core.editor nano

问题是我有两个环境变量指向我的.bash_profile /usr/bin/mate所以我编辑它们指向vim

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM