Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git editor error

I get following error message, when I try to run git rebase -i for squashing my commit:

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

How does git look for the editor? From the git-sh-setup file, I can only see this method:

git_editor() {                                                                       
    if test -z "${GIT_EDITOR:+set}" 
    then                                                                             
        GIT_EDITOR="$(git var GIT_EDITOR)" || return $?                              
    fi                                                                               
    eval "$GIT_EDITOR" '"$@"'                                                                                                                                                    
} 
like image 886
Jason Wuong Avatar asked Sep 25 '26 06:09

Jason Wuong


1 Answers

There is a setting in ~/.gitconfig like this:

[core]
    editor = mate

If you have textmate added to you PATH then you can just changed it to: editor = mate. Just make sure that it is added there.

echo $PATH to check if textmate is there.


You can also change the configuration option through git config. The option to chage is core.editor. For example:

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

to make the setting available in all your repositories add --global flag to git config

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

From git help config manpage:

core.editor
Commands such as commit and tag that lets you edit messages by launching an editor uses the value of this variable when it is set, and the environment variable GIT_EDITOR is not set. See git-var(1).

like image 61
bx2 Avatar answered Sep 27 '26 20:09

bx2



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!