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!
Oldest comments (11)
You may have already tried this, but does running
code --waitdirectly work. Also try changing the editor setting tocode --disable-extensions --waitto 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!
If you're using the command line to handle your commits you may want to try exporting your
EDITOR.You can validate the export
I prefer
vimfor 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.
Got an idea from Stackoverflow -- I figured out how to edit my environment variables by typing
open .bash_profilein the terminal and sure enough, my default didn't have the--waitflag on it. I'm attaching a screenshot for visual people.Had the same problem using zsh. Same fix, but the file is .zprofile
Thanks for the comment Bryan! We're covering all the bases here! 😃
This worked for me if anyone else scrolls this far done.
For thoroughness, I use atom so in my .gitconfig it reads
[core]
editor = atom -w
Hi there,
Thank you for all the advice. I have looked at all the suggestions, and I have checked my .gitconfig file: editor = atom -w is set correctly, yet I still have the same issue.
Hey Badran! Can you take a screen shot of your
.gitconfigfile? (Obviously, blur out the sensitive info.) Also what operating system are you on?