2014-11-14 154 views
4

最近我在終端安裝了bash-it。現在,當我嘗試執行git commit終端顯示我這個錯誤:Git-commit無法打開vim

/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.

之前bash-it,commit命令正確打開VIM。 當然,我試圖將git中的core.editor更改爲「vim」,但它無論如何都不起作用。

你能幫我解決這個問題嗎?我非常喜歡vim,它非常容易和快速......我不想使用TextMate來編輯提交消息。

PS:我正在使用Mac OSX

+0

檢查'EDITOR'或'VISUAL'環境變量。其中一個可能指向'/ usr/bin/mate'。 – Paul 2014-11-14 13:21:51

+0

謝謝保羅,你說得對,我不得不環境變量指向: ''#設置我的編輯器和git編輯器 export EDITOR =「/ usr/bin/mate」export GIT_EDITOR ='/ usr/bin/mate -v'''' 我編輯了我的.bash_profile並刪除了那些,設置vim: '''設置我的編輯器和git編輯器 export EDITOR =「/ usr/bin/vim」 export GIT_EDITOR ='/ usr/bin/vim'''' – imran3 2014-11-14 13:37:42

回答

0

的問題是,我有兩個環境變量,在我的.bash_profile 指出/usr/bin/mate,所以我編輯它們指向vim

14

請嘗試使用以下命令。應該可以將編輯器重新設置爲vi或vim。但是,你可能不得不給vim的絕對路徑。

git config --global core.editor vim 
+0

正如我所說的,我的core.editor已經設置爲vim,問題是我必須在''.bash_profile'中環境變量'/ usr/bin/mate' – imran3 2014-11-14 13:41:16

+1

對我來說,這個問題解決了我嘗試重新綁定文本文件時會在我的編輯器中打開的問題,我需要使用vim重命名提交消息並遍歷最近的幾次提交 – 2016-01-26 23:25:59

1

如果其他的答案不工作,嘗試export GIT_EDITOR=vim

0

正如「abalos」回答,

git config --global core.editor vim 

如果你不想使用vimvim安裝在一些情況下,你沒有, 您還可以使用nano編輯

git config --global core.editor nano