1

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 ?

2
  • editor is not a variable. In Debian, it's aliased to an editor command. See which editor, and also namei $(which editor). Commented Jan 5, 2017 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. Commented Jan 5, 2017 at 18:08

2 Answers 2

2

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.

0

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.