voltajc
voltajc

Reputation: 61

GIT Error "hint: Waiting for your editor to close the file

like the title mentions I get this error "hint: Waiting for your editor to close the file... " every time I try to commit with this command: git commit. I must mention I am able to commit whilst leaving a message using (-m)

brand new developer here, literally, this is my 4th day at w. development school.
I am using the Pixelbook (Chromebook), Set up with Linux (Beta), it comes with the pixel book. I am using Visual Code Editor (the only one I can use for now because of school)

I told the teachers but they told me not to worry about it but I do. I do not wanna move onto something way harder and then have to deal with a bunch of installing and uninstalling that I do not even understand. Will I ever need to commit whilst using this command: "git commit"? or is it always good to leave a small comment?

I tried doing this https://stackoverflow.com/a/52196507/16928769 which I found here but it does not work, at least following the instructions literally. There might be something I am missing quite simple and obvious but I am only 4 days in.

I have checked and the editor is always closed. I tried closing every open file on the editor etc and nothing changes. Thanks a lot for deciding to waste your time with a newbie like me, much appreciated.

Upvotes: 6

Views: 16411

Answers (2)

bk2204
bk2204

Reputation: 76934

Git is designed to operate with a wide variety of editors. Some of those editors are terminal-based, like some versions of vi and Emacs, and some are graphical, like Visual Studio Code or Atom.

When Git spawns an editor, it doesn't know whether or not it will be graphical. However, if the editor is graphical, then it may pop up in a window that isn't immediately visible: for example, it may end up behind the current window. This message simply indicates to the user that Git isn't hung; it's waiting for you to edit the commit message, save, and quit the editor. It's merely a helpful hint to help users avoid a potentially confusing situation.

Upvotes: 3

CodeWizard
CodeWizard

Reputation: 142602

You have set up your editor to be something like notepad or any other external program for your editor.

Once you try to commit it open, you have to type your message and close it.


Check to see your editor:

# Show which editor and it path
git config -l --show-origin | grep editor

Using VSCODE

If you are using VSCOde as you mentioned you can commit directly from it.

Open Git "view"

enter image description here

Stage files

enter image description here

Write your commit message

enter image description here

Upvotes: 6

Related Questions