Git editor error

editor, git, git-config

Solution

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

Problem

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" '"$@"' } ```

Original source