I cloned a repo (using fictious examples here)

$ git clone http://someplace.somedomain.name/resource.git 

went to the directory

$ cd resource

and then tried to edit a file within the resource directory

/home/shirish/resource $ editor somefile.txt

Now I am not familiar with what editor is being used by git and if it something internal. I am running git 2.11.0 on Debian testing.

I did hunt around and saw this https://help.github.com/articles/associating-text-editors-with-git/ but the documentation doesn't tell me how do I search to know/see which editor it uses. Is there a way ?

  • editor is not a variable. In Debian, it's aliased to an editor command. See which editor, and also namei $(which editor). – janos Jan 5 '17 at 18:03
  • But if you do set a default editor for Git with git config --global core.editor XXX, it usually goes into ~/.gitconfig. You can also ask Git what is the value of that variable by issuing the same command without XXX. – giusti Jan 5 '17 at 18:08

In Debian, the editor command is an alternative:

sudo update-alternatives --config editor

It's not managed by git.

When a git commands needs an editor (e.g. for a commit message), it uses the editor given by the GIT_EDITOR environment variable, or failing that, the editor specified by the core.editor variable. See git-var(1) and git-config(1) for details; but basically to set it up globally, run

git config --global core.editor emacs

which will store your preference in .gitconfig in your home directory.

| improve this answer | |

You can use type editor to see what your shell does when editor is entered. I don't believe it has anything to do with Git.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.