git - 当我提交 Git 时,找不到 cmd.exe

标签 git atom-editor commit git-commit

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

相关文章:

clojure - 如何使用 Figwheel 设置 Atom 编辑器以进行 clojurescript 开发?

jquery - 如何通过 jQuery 获取 GitHub 存储库上最新提交的 SHA?

java - Eclipse + Maven 插件 + EGit 插件 = 从 GitHub checkout 一个特定的分支和标签?

git - 在其他提交完成后从 git rebased 分支中删除提交

syntax - 如何在 Atom 中为 Twig 文件设置默认语法突出显示?

c - Atom.io 缺少 sys/wait.h 或允许 fork()

git - git commit 后无法通过评论部分?

php - 由于网站所有者进行实时更改,因此在两个目录之间执行 "git diff"

git - 什么是 IntelliJ IDEA 中的更改列表?