简体   繁体   English

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

[英]Unable to commit files to Git Bash on macOS High Sierra 10.13.3

I've configured my core editor, and everything works just fine. 我已经配置了核心编辑器,并且一切正常。 I can open any file in my editor, from the command line. 我可以从命令行在编辑器中打开任何文件。

But, when I get to 'git commit' I'm getting this error: 但是,当我进入'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.

I've tried with Sublime first, than Brackets and Atom. 我先尝试过Sublime,而不是Brackets和Atom。 I've even tried to reset the .gitconfig ( rm ~/.gitconfig ) and nothing changed. 我什至尝试重置.gitconfig( rm ~/.gitconfig ),但没有任何改变。

It's there any command to fix this error? 是否有任何命令可以修复此错误? Or do I have to uninstall git? 还是我必须卸载git?

As @MarkAdelsberger noticed, you seem to have set your editor to --unset-all . 正如@MarkAdelsberger注意到的那样,您似乎已将编辑器设置为--unset-all Maybe you confused the order of arguments and called git config --global core.editor --unset-all ? 也许您混淆了参数的顺序,并将其称为git config --global core.editor --unset-all That would lead to the situation you describe. 这将导致您描述的情况。

Git has three levels of settings: global, system and local (repository). Git具有三个级别的设置:全局,系统和本地(存储库)。 Deleting ~/.gitconfig will only get rid of the global settings, so maybe you screwed somewhere and changed the editor configuration on another level. 删除~/.gitconfig只会删除全局设置,因此也许您在某个地方搞砸了,并在另一个级别上更改了编辑器配置。 You can try to reset the editor settings on all levels with with the correct syntax: 您可以尝试使用正确的语法在所有级别上重置编辑器设置:

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

This should reset to the default editor. 这应该重置为默认编辑器。

It could also be that you forgot to add a message after your commit. 也可能是您忘记在提交后添加消息。 For example: git commit -m "This is my message" 例如:git commit -m“这是我的消息”

I was getting the same error, was trying to use an alias as the path. 我遇到了同样的错误,试图使用别名作为路径。 Found using the full path to sublime cleared the problem. 发现使用完整路径升华就可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM