当我执行Git提交时,找不到cmd.exe

问题描述 投票:2回答:1

对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.

抱歉,这是一个令人困惑的问题,我在这个问题上待了很长时间。谢谢

git atom-editor commit git-commit
1个回答
1
投票

作为I 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

我尝试过dan1sts method

export PATH=/c/Windows/System32:$PATH 

并且当我在git bash中输入atom时,它终于打开了。

关于IDE Atom,请检查您的Git integration

git config --global core.editor "atom --wait"
© www.soinside.com 2019 - 2024. All rights reserved.