bash Git提交无法打开vim
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26930924/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git-commit unable to open vim
提问by imran3
Recently I installed bash-it
into my terminal. Now, when I try to execute git commit
the terminal shows me this error:
最近我安装bash-it
到我的终端。现在,当我尝试执行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.
/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.
Of course I've tried to change the core.editor
in git to "vim" but it does not work anyway.
之前bash-it
,commit 命令正确打开vim。当然,我已经尝试将core.editor
git 中的更改为“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
采纳答案by imran3
the problem was that i had two environment variables that pointed to /usr/bin/mate
in my .bash_profile
so i edit them to point to vim
问题是我有两个环境变量指向/usr/bin/mate
我的.bash_profile
所以我编辑它们指向vim
回答by abalos
Try using the below command. Should be able to set your editor back to vi or vim. However, you might have to give the absolute path to vim.
尝试使用以下命令。应该能够将您的编辑器设置回 vi 或 vim。但是,您可能必须提供 vim 的绝对路径。
git config --global core.editor vim
回答by Stevan Tosic
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
回答by Ken H
If other answers don't work, try export GIT_EDITOR=vim
如果其他答案不起作用,请尝试 export GIT_EDITOR=vim