2012-07-03 29 views
1

我获得以下错误消息,当我试图为挤压运行git rebase -i我承诺:Git的编辑错误

/usr/libexec/git-core/git-sh-setup: line 112: mate: command not found 

如何混帐认准编辑器? 从git-sh-setup文件,我只能看到这种方法:

git_editor() {                  
    if test -z "${GIT_EDITOR:+set}" 
    then                    
     GIT_EDITOR="$(git var GIT_EDITOR)" || return $?        
    fi                    
    eval "$GIT_EDITOR" '"[email protected]"'                                      
} 

回答

6

有一个在~/.gitconfig这样的设置:

[core] 
    editor = mate 

如果你有textmate添加到您PATH那么你可以只将其更改为:editor = mate。 只要确保它被添加到那里。

echo $PATH检查文本是否存在。


您还可以通过git config更改配置选项。 chage选项是core.editor。例如:

$ git config core.editor  # the current set editor 
mate 
$ git config core.editor vim # change editor to vim 
$ git config core.editor 
vim 

,使您的所有软件仓库的设置添加--global标志git config

$ git config --global core.editor <editor-of-choice> 

git help config手册页:

core.editor
这样的命令作为提交和标记,让您通过启动编辑消息编辑器在设置时使用此变量的值,并且未设置环境变量GIT_EDITOR。参见git-var(1)。

+0

我添加了一些东西,如果这对你很好。 – c00kiemon5ter

+0

当然,谢谢:) – bx2

0

正如你可以在脚本中看到,它采用git var,根据git help var其作用:通过git命令使用

GIT_EDITOR

文本编辑器。该值用于在shell中进行解释。示例:~/bin/vi$SOME_ENVIRONMENT_VARIABLE, "C:\Program Files\Vim\gvim.exe" --nofork

偏好的顺序是$GIT_EDITOR环境变量,则core.editor配置,那么$VISUAL,然后$EDITOR,然后最后vi