'Git commit command is not working properly with atom editor
When I give the command "$git commit" to git bash, then
$ git commit
hint: Waiting for your editor to close the file... atom --wait: atom: command not found
error: There was a problem with the editor 'atom --wait'.
Please supply the message using either -m or -F option.
this error is thrown by git. I have configured atom in git using this command :-
$ git config --global core.editor "atom --wait"
Solution 1:[1]
If this problem appears, you have to :
1 - Go to the Atom menu.
2 - Select "Install Shell Commands".
3 - Restart the terminal
It's magic it works :D
Solution 2:[2]
Here are some tools to figure this out.
Check current configuration:
git config --list
Check Status:
git status
See which configuration below works for the atom text editor:
git config --global core.editor "atom"
git config --global core.editor "atom --wait"
git config --global core.editor "atom -w -s"
Be sure to leave a message in the file that opens after running "git commit" in terminal. Save and completely exit the editor.
Solution 3:[3]
Walking down the error you included:
hint: Waiting for your editor to close the file...
tells you that git has attempted to open your specified editor to write a commit message. This much is normal. The next part:
atom --wait: atom: command not found
tells you that git tried to execute $ atom --wait
, but couldn't find the atom
command. This indicates that the atom
command was either never installed, or is not on your path. (For reference, the executable to run Atom on my Mac is located at /usr/local/bin/atom
)
The solution depends on your operating system.
Solution for Mac
This exactly matches the problem described by the Installing Atom on Mac official documentation:
When you first open Atom, it will try to install the
atom
andapm
commands for use in the terminal. In some cases, Atom might not be able to install these commands because it needs an administrator password.
Therefore...
To install the
atom
andapm
commands, run "Window: Install Shell Commands" from the Command Palette, which will prompt you for an administrator password.
Alternatively, the steps given in Fizik26's Answer will accomplish the same thing.
Note: the "Window: Install Shell Commands" action only seems to be available on Mac, not Windows or Linux.
Solution 4:[4]
In my case for Windows 10, I only uninstalled Git (v2.32) and kept Atom. I re-installed Git, and I chose Atom to be my default editor from the drop-down menu that appears in the installation wizard.
If you kept pressing the NEXT button during the installation, you will end up with VIM as your default editor, and we sure don't want that.
Solution 5:[5]
This is because there is no atom command at least in the PATH. To enable opening Atom from the command-line, you will need to install shell commands from the either the Atom menu or the Atom Command Palette. Next ensure that atom is in your path.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Fizik26 |
Solution 2 | dukeOfEarl |
Solution 3 | drmuelr |
Solution 4 | Tomerikoo |
Solution 5 | Özgür Murat Sağdıçoğlu |