【问题标题】:Unable to commit files to Git Bash on macOS High Sierra 10.13.3无法在 macOS High Sierra 10.13.3 上将文件提交到 Git Bash
【发布时间】:2018-08-16 18:55:24
【问题描述】:

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

但是,当我进入“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?

【问题讨论】:

  • 您最初用于配置编辑器的命令是什么? .gitconfig有好几级,其中一个好像指定了错误的路径。
  • "我已经配置了我的核心编辑器" ... 通过做什么?能够在 bash 提示符下打开编辑器与配置 git 以在需要生成编辑器时运行正确的命令是完全不同的问题。从错误消息来看,您似乎已将 git 配置为运行 --unset-all 作为编辑器命令,这肯定不是正确的配置。
  • @kowsky,@MarkAdelsberger,命令是$ git config --global core.editor "subl -n -w"。但它不起作用,所以我用$ git config --global --unset-all core.editor 删除了它。在我使用$ /usr/local/bin/Brackets 添加括号的路径之后

标签: git git-bash macos-high-sierra


【解决方案1】:

我遇到了同样的错误,试图使用别名作为路径。发现使用 sublime 的完整路径清除了问题。

【讨论】:

    【解决方案2】:

    也可能是您在提交后忘记添加消息。例如: git commit -m "这是我的消息"

    【讨论】:

      【解决方案3】:

      正如@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
      

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

      【讨论】:

        猜你喜欢
        • 2018-08-13
        • 2018-10-28
        • 2023-03-15
        • 2018-08-06
        • 2015-12-29
        • 1970-01-01
        • 1970-01-01
        • 2018-03-27
        • 2019-02-03
        相关资源
        最近更新 更多