无法在 macOS High Sierra 10.13.3 上将文件提交到 Git Bash

Unable to commit files to Git Bash on macOS High Sierra 10.13.3

我已经配置了我的核心编辑器,一切正常。我可以从命令行在我的编辑器中打开任何文件。

但是,当我到达 'git commit' 时,我收到了这个错误:

hint: Waiting for your editor to close the file... fatal: cannot run --
unset-all: No such file or directory
error: unable to start editor '--unset-all'
Please supply the message using either -m or -F option.

我首先尝试使用 Sublime,而不是 Brackets 和 Atom。我什至尝试重置 .gitconfig (rm ~/.gitconfig) 但没有任何改变。

有什么命令可以修复这个错误吗?或者我必须卸载 git?

正如@MarkAdelsberger 所注意到的,您似乎已将编辑器设置为 --unset-all。也许你混淆了参数的顺序并调用了git config --global core.editor --unset-all?那会导致你描述的情况。

Git具有三个级别的设置:全局、系统和本地(存储库)。删除 ~/.gitconfig 只会删除全局设置,所以也许您搞砸了某个地方并在另一个级别更改了编辑器配置。 您可以尝试使用正确的语法重置所有级别的编辑器设置:

git config --global --unset-all core.editor
git config --system --unset-all core.editor
git config --unset-all core.editor

这应该重置为默认编辑器。

也可能是您提交后忘记添加消息。例如: git commit -m "This is my message"

我遇到了同样的错误,正在尝试使用别名作为路径。发现使用完整路径升华解决了问题