对 git 很陌生,所以如果我犯了任何明显的错误,我很抱歉。
当我执行 git commit 时,它会打印以下消息:
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.
我假设它与写在 atom.sh 文件中的 cmd.exe
有关,但我不确定,我尝试重新安装 atom 和 git 但没有。而我做到了
git config --global code.editor "atom --wait"
我还尝试用它的实际目录路径替换“atom”,然后它说:
Waiting for your editor to close the file...
and says aborted due to empty commit message, then opens atom editor.
如果这个问题有点令人困惑,我很抱歉,我已经被困在这个问题上这么久了。 谢谢
最佳答案
作为我mentioned here ,确保使用简化但完整的 PATH 重新启动 Atom。
需要包含Microsoft Windows路径。
打开 CMD,然后输入:
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%
从该 CMD 窗口启动 Atom。如果你愿意,你可以切换到 git bash。但只有在 CMD 中有适当的 PATH 之后。之前没有。
然后查看错误消息是否仍然存在。
OP Safe Rehman建议in the comments :
I tried dan1sts method
export PATH=/c/Windows/System32:$PATH
and when I enter atom in git bash it opens finally.
关于 IDE Atom,检查您的 Git integration :
git config --global core.editor "atom --wait"
关于git - 当我提交 Git 时,找不到 cmd.exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60362949/