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

asked7 years ago
last updated6 years ago
viewed173.2k times
Up Vote108Down Vote

I'm trying just git commit and Git is giving this message:

hint: Waiting for your editor to close the file... /c/Users/AGT/AppData/Local/Programs/Microsoft VS Code/bin/code: line 28: /Code.exe: No such file or directory error: There was a problem with the editor 'code --wait'. Please supply the message using either -m or -F option.

I'm using, or trying it, VS Code as default and I got this same message with it opened or closed. Commits done through VS Code or by command git commit -m "Initial commit" works fine. I tried change config path with:

  • git config --global core.editor "code --wait"- git config --global core.editor "'C:\Users\AGT\AppData\Local\Programs\Microsoft VS Code\Code.exe' -n -w"- - -

No success at all.

The git status is:

On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   css/app.css
        new file:   index.html
        new file:   js/app.js

How can I fix that to git commit command through Git BASH works fine with Vs Code? It's seems path issue.

Update info: I tested git commit with Sublime 3 and it works fine.