How can I fix git commit error “Waiting for your editor to close the file…” with VS Code?

后端 未结 10 1810
执念已碎
执念已碎 2020-12-13 06:32

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/Loc

相关标签:
10条回答
  • 2020-12-13 06:49

    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?
    0 讨论(0)
  • 2020-12-13 06:50

    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.

    0 讨论(0)
  • 2020-12-13 06:52

    It is expecting you to enter the comments regarding the commit you are making enter comment and it should commit the code.

    0 讨论(0)
  • 2020-12-13 06:54

    I got that error while i configured with Atom.

    I got it solved by opening the app in background before executing the command git commit

    You can also try using $ git commit -m "Initial commit" It directly passes the message without waiting for the editor to open NOTE: You wont be able to add description just a comment

    0 讨论(0)
  • 2020-12-13 06:56

    Change git commit to git commit -m "Title of your update".

    0 讨论(0)
  • 2020-12-13 06:58

    For people having Atom as default editor for Git-related stuff

    When Atom was a default code editor for it, there was some kind of conflict between Atom and Visual Studio Code. Opening a Terminal in Visual Studio Code and hitting git config --global core.editor "code --wait" solved the problem. Then Visual Studio Code opened a new tab each time I was doing something in the console without crashing.

    0 讨论(0)
提交回复
热议问题