【问题标题】:How to fix the git commit如何修复 git 提交
【发布时间】:2019-02-08 15:24:56
【问题描述】:

几天前,我尝试配置 Sublime Text 3,这样当我在 git 中提交时它会打开,但总是会出现错误,当我尝试放回 vim 时,我得到了这个:

MacBook-Air-de-Andres:bin andr3yvlz$ git config --global core.editor vim
warning: core.editor has multiple values
error: cannot overwrite multiple values with a single value
       Use a regexp, --add or --replace-all to change core.editor.

我也尝试这样做:

MacBook-Air-de-Andres:bin andr3yvlz$ git config --replace-all core.editor vim
fatal: not in a git directory
MacBook-Air-de-Andres:bin andr3yvlz$ 

提交错误是:

MacBook-Air-de-Andres:Andr3yvlz andr3yvlz$ git add .
MacBook-Air-de-Andres:Andr3yvlz andr3yvlz$ git commit
hint: Waiting for your editor to close the file... subl -n -w: subl: command not found
error: There was a problem with the editor 'subl -n -w'.
Please supply the message using either -m or -F option.
MacBook-Air-de-Andres:Andr3yvlz andr3yvlz$ 

如果有人知道如何使用 git 配置 sublime,那将非常有帮助,在此先感谢

【问题讨论】:

  • 您可以使用git config --global --replace-all 更改它(同时提供两个选项)。
  • 我建议打开你的用户配置文件的.gitconfig 文件,看看你在哪里有core.editor 的副本,并可能在那里进行调整(尽管建议使用 git 命令进行更改)。你应该可以在 Mac 上找到它:~/.gitconfig

标签: git macos terminal


【解决方案1】:

您可以尝试从~/.gitconfig 中删除选项code.editor 然后添加它。

$ git config --global --unset-all core.editor
$ git config --global core.editor "vim"

【讨论】:

    猜你喜欢
    • 2012-01-02
    • 2011-07-18
    • 2012-02-08
    • 2016-11-25
    • 1970-01-01
    • 2017-11-19
    • 2018-01-24
    • 1970-01-01
    相关资源
    最近更新 更多