1

I was using git in JetBrains IDE WebStorm terminal (based on Windows PowerShell). While trying to commit without a message, I got this message:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.

I tried searching how to exit that, but nothing worked (ESC -> :wq or ctrl+c -> ctrl+x or other editor commands, but since I never set the editor, it should be Vim). I guess that's because when I press ESC, IDE escapes the terminal and throws me to code editing window, and the editor never gets to read that ESC.

Is there any way to exit, or I have to restart the terminal?

(Please don't tell me how to change default editor, I definately will do this later)

GaussGun
  • 100
  • 1
  • 9

1 Answers1

1

but since I never set the editor, it should be Vim

Check what git config core.editor returns (from the root folder of your repository, in your IDE Powershel terminal)

That way, you will know more about the actual nature of the editor (as illustrated here), which can then guide you in your search to exit it.

As noted in the comments, since git config core.editor is empty, it is best to set it up, avoiding the default behavior.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • It returns nothing: https://ibb.co/qYwRYM5 – GaussGun Jul 21 '22 at 08:44
  • @GaussGun OK so can you configure it and see if you can retry your commit? – VonC Jul 21 '22 at 08:50
  • I'm having problems with setting atom as editor. I have it installed, but command `git config --global core.editor "atom --wait"` stated on atom offical page is not working. GIt says *cannot spawn atom: No such file or directory*. What am I doing wrong? – GaussGun Jul 21 '22 at 09:15
  • 1
    @GaussGun You might need to specify the full path of the exe, as [in here](https://stackoverflow.com/a/61099343/6309). – VonC Jul 21 '22 at 09:34
  • thanks, needed to specify the path. But now it opens Atom in a window, and immediately I get `Aborting commit due to empty commit message.` in my terminal. I downloaded wrong Atom? – GaussGun Jul 21 '22 at 09:47
  • @GaussGun Did you try with `-n -w` as [in this comment](https://stackoverflow.com/questions/37706443/git-commit-command-with-core-editor-equals-atom#comment125404410_37707106)? – VonC Jul 21 '22 at 09:49
  • I ended up with notepad++, works fine – GaussGun Jul 21 '22 at 11:37