Git commit aborts before I can create a commit message and I use “--wait”

meg_gutshall profile image Meg Gutshall ・1 min read

I use Visual Studio Code on my Mac as my text editor and have it set up to open a new window to type my commit message, however when I type 'git commit' in the terminal, it instantaneously displays 'Aborting commit due to empty commit message.'

I have my git config set up as 'git config --global core.editor "code --wait"' and when I type 'git config --global -e' it shows '[core] editor = code --wait'. I've uninstalled and reinstalled git, I've went through the VS Code as Git Editor setup guide, and have searched online for a solution for at least ten hours. My git and VS Code versions are up to date and my commits work when I type 'git commit -m "message here"' in the command line, but I still don't know why my VS Code editor option isn't working.

Any ideas here? Thank you!

Posted on by:

meg_gutshall profile

Meg Gutshall


Full stack web dev. Always smiling. Spanish speaker. Avid animal lover. Philly all the way. I take advice with a grain of salt & a shot of tequila. #TempleMade Twitter: @meg_gutshall


markdown guide

If you're using the command line to handle your commits you may want to try exporting your EDITOR.

$ export EDITOR="$(which code) --wait"

You can validate the export

$ echo $EDITOR
/usr/local/bin/code --wait

I prefer vim for editing, however, I do use vscode from time to time. I only ran the following commands above and was able to end up here. Hopefully, this works for you.



This didn't work either. I think I may have downloaded something that's interfering...


You can also use the built-in functionality.



You may have already tried this, but does running code --wait directly work. Also try changing the editor setting to code --disable-extensions --wait to see if that helps.
It might be that the editor is crashing for some reason and returning an empty commit message.


I tried this out but no luck. Thanks anyway!


Got an idea from Stackoverflow -- I figured out how to edit my environment variables by typing open .bash_profile in the terminal and sure enough, my default didn't have the --wait flag on it. I'm attaching a screenshot for visual people.

Screenshot of solution