Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
$ git commit  
error: cannot run vim: No such file or directory
error: There was a problem with the editor 'vim'.
Please supply the message using either -m or -F option.

How can I overcome the error and define the editor?

share|improve this question
Do you want to run vim or some other editor? If you want to run vim, does it work if you run it from the command line? – Gilles Sep 24 '12 at 0:22

Besides installing vim or specifying the commit message on the command-line like the error message suggested, there are several ways to tell git which editor it should use. You can set the core.editor property (locally for that project, or globally for all of git):

$ git config --global core.editor nano

You can also set the EDITOR environment variable, which git will fall back on if core.editor isn't set:

$ export EDITOR=nano
share|improve this answer
up vote 2 down vote accepted

The answer was:

sudo apt-get install vim

as it was a new machine and vim wasn't installed.

share|improve this answer
Couldn't "the answer" also have been export EDITOR=vi? – dubiousjim Sep 24 '12 at 7:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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