How can I fix git commit error "Waiting for your editor to close the file..." with VS Code?

Have you confirmed that code is accessible from the command line where you execute git commands?

You could run code --version

BTW. When I execute where code I get C:\Program Files\Microsoft VS Code\bin\code - it's no longer installed in the %App_Data% folder. Howerver, this should be irrelevant if you only specify code --wait without the path.

In other words, here is the procedure I would attempt:

  1. Confirm code --version works in the console you use for git
  2. git config --global core.editor "code --wait"
  3. Change things in you branch and then git commit. Does VS Code start and show COMMIT_EDITMSG file? enter image description here

Putting the name of the editor in double quotes produced this error for me. Put the name of the editor in single quotes, like:

git config --global core.editor 'vi'

Or, try switching to double quotes if you're already using single quotes.


Any file may be opened in any editor. So run "ps -ax|grep vim" to check which file is opened in which editor. And then run kill id-of-editor . For e.g. "kill 12345" Thats all