'When I Git commit, cmd.exe not found
Quite new to git, so if i made any obvious mistakes I am sorry.
When I do git commit, it prints the following message:
hint: Waiting for your editor to close the file... /c/Users/UserName/AppData/Local/atom/bin/../app-
1.44.0/resources/cli/atom.sh: line 23: cmd.exe: command not found
Aborting commit due to empty commit message.
I am assuming it is to do with cmd.exe
written in atom.sh file, but I am not sure, I tried reinstalling atom and git but nothing. And i did
git config --global code.editor "atom --wait"
I also tried replacing "atom" with its actual directory path, then it says:
Waiting for your editor to close the file...
and says aborted due to empty commit message, then opens atom editor.
Sorry if it is a bit confusing question, I have been stuck on this for so long. Thanks
Solution 1:[1]
As I mentioned here, make sure to re-launch Atom with a simplified but complete PATH.
It needs to include Microsoft Windows path.
Open a CMD, and type:
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%
set PATH=%LOCALAPPDATA%\atom\bin;%PATH%
Launch Atom from that CMD windows. And you can switch to git bash if you want. But only after having a proper PATH in a CMD. Not before.
See if the error message persists then.
The OP Safe Rehman proposes in the comments:
I tried dan1sts method
export PATH=/c/Windows/System32:$PATH
and when I enter atom in git bash it opens finally.
Regarding the IDE Atom, check your Git integration:
git config --global core.editor "atom --wait"
Solution 2:[2]
I had a similar issue, It was resolved when I added the "%SystemRoot%\system32" value to the "Path" variable in the Environmental variable.
Solution 3:[3]
@dan1sts method work!!!! I have tried so many methods, thanks god, let me try to make a summary here.
Step 1: Ensure you have added the PATH into system variables.
Search variables from 'Start', click 'Edict the system environment variables'
Click 'Environment Variables'
Under the 'System Variables', Select 'Path' and Click 'Edit'
Check if you have these two Path, if not, add them and click 'OK'
- 'C:\Program Files\Git\bin;'
- 'C:\Users\XXX\AppData\Local\atom\bin' (XXX is your windows user name)
Once you done it, re-open the git bash, type
which atom
you will see
'/c/Users/XXX/AppData/Local/atom/bin/atom'
Step 2: Then you could simply type
export PATH=/c/Windows/System32:$PATH
on the Git Bash.
And finally type
atom .
it works to me!!!!!
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 | Community |
Solution 2 | Ameen Maheen |
Solution 3 | Yuzhou Lin |