8
$ 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?

  • 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
12

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
4

The answer was:

sudo apt-get install vim

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

  • 1
    Couldn't "the answer" also have been export EDITOR=vi? – dubiousjim Sep 24 '12 at 7:03

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.