Jackson
Jackson

Reputation: 6871

Vi Error while making git commit

I am attempting to make a git commit. I run the command git commit and vim opens up. I type in my commit message, and when I execute the :wq command, I get the following error:

error: There was a problem with the editor 'vi'. Please supply the message using either -m or -F option.

Any idea how I can figure out what the problem is?

Upvotes: 4

Views: 1257

Answers (2)

Heath Borders
Heath Borders

Reputation: 32167

If you want to recover the commit message, you can look in .git/COMMIT_EDITMSG.

This file contains the commit message of a commit in progress. If git commit exits due to an error before creating a commit, any commit message that has been provided by the user (e.g., in an editor session) will be available in this file, but will be overwritten by the next invocation of git commit.

Upvotes: 1

Mr Rubix
Mr Rubix

Reputation: 1529

To fix this problem change your git editor path

git config --global core.editor /usr/bin/vim 

SOURCE

Upvotes: 6

Related Questions