0

When I type git commit Atom should open, but it doesn't.

For the configuration on command prompt, I typed:

config --global core.editor "atom --wait"

When I type:

git commit

It says:

hint: waiting for your editor to close the file .......

error: there was a problem with the editor  "atom --wait"

Please supply the message using either -m or -F option.
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
  • You should use git commit with the -m option. because a git commit always need a explain message. For example: git commit -m "add the search feature" – pcampana Apr 08 '20 at 11:10
  • but on the videos i watched, they just used "git commit" without using -m or something else. –  Apr 08 '20 at 12:27
  • What happens if, at the command line prompt (`$` or whatever it is), you enter the command: `atom --wait somefile.ext`? Does that work at all? If so, what does it do: does it invoke the `atom` editor and then wait for it to exit, to signal that you have finished editing the file? If not, what *does* work to invoke `atom` and wait for it to exit? – torek Apr 08 '20 at 12:36
  • @torek hey, thanks for replying but since i couldnt get my atom work, i just deleted and installed again if i could solve. It didnt solve it, then i set my core.editor as default "vim", now its working. –  Apr 08 '20 at 13:38
  • 1
    I use vim myself, it's a perfectly good editor. If you do want to get atom working and use atom, follow the above idea: find out how to invoke atom from the command line. Once you know how to do that, you know how to instruct *Git* to do that. The `core.editor` setting is how you tell Git what command-line command to use to invoke your preferred editor. – torek Apr 08 '20 at 13:52
  • thank you for your relpy. This is my first time trying to use git, because i want to know how to share codes on github. I have to learn it –  Apr 08 '20 at 14:33
  • Don't add "Solved" to a title. Simply mark the appropriate answer as selected. See https://stackoverflow.com/help/someone-answers – the Tin Man Apr 15 '20 at 05:50

1 Answers1

1

As it is explained in "Git commit fails: "Please supply the message using either -m or -F option."", you should check your git config core.editor value. It might refer to a path with spaces in it, without quotes.

Make sure to use single quotes when registering that editor path, and double quotes around all command expressions registered, along with '/' instead of '\' for the path separator.

git config core.editor "'C:/path/with spaces/xxx.exe' -<someoptions>"
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
pcampana
  • 2,413
  • 2
  • 21
  • 39
  • $ git config core.editor "'C:/Users/bilim/AppData/Local/atom/atom.exe'" fatal: not in a git directory, it gave me an error, i couldnt do it. So ill just try to watch youtube series or find some tutorials.. thanks for replying –  Apr 08 '20 at 12:26
  • Because you need to be in a git resository when you execute this command – pcampana Apr 08 '20 at 12:31
  • 2
    @Semih Use `git --global config` ..., then you don't need to be in a git repo. I think pcampana missed the global flag in your question. – wjandrea Apr 10 '20 at 19:51
  • @wjandrea thank you, i just solved the problem by changing my editor to vim :) but thanks for answering to you both. –  Apr 12 '20 at 19:22