MacOS – git commit editor error ‘subl -n -w’

gitmacosterminal

On my ElCapitan, I have vim installed but my git commit is giving errors:

$ git commit
subl -n -w: subl: command not found
error: There was a problem with the editor 'subl -n -w'.
Please supply the message using either -m or -F option.

Is there a way to fix this? Thanks

Best Answer

It appears that Your default editor is Sublime Text instead of vim. You can change it with this command:

git config --global core.editor vim