Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
$ 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
add comment

2 Answers

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
add comment
up vote 1 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
add comment

Your Answer

 
discard

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.