从 git config --edit 更改行后如何保存配置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11626035/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 07:15:29  来源:igfitidea点击:

How to save the configuration after changing lines from a git config --edit

git

提问by rukia_kuchiki_21

allow me to explain my query here.

请允许我在这里解释我的查询。

I'm trying to reset all authors including my git-pairs

我正在尝试重置所有作者,包括我的 git-pairs

git pair --resetisn't working anymore. A documentation had advised me to do the configuration using git config --edit

git pair --reset不再工作了。文档建议我使用git config --edit

I entered the command git config --edit

我输入了命令 git config --edit

and removed the

并删除了

[user]and [git-pair]values...

[user][git-pair]价值观...

How can I save the configuration after? Should I hit something from the keyboard or what.

之后如何保存配置?我应该从键盘上敲什么东西还是什么。

I just know how to insert stuffs in there by pressing Insert button from keyboard but I dont know how to save the config and go back to the command prompt earlier.

我只知道如何通过按键盘上的“插入”按钮在其中插入内容,但我不知道如何保存配置并更早地返回命令提示符。

I want to save the new config file which is:

我想保存新的配置文件,它是:

[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
        hideDotFiles = dotGitOnly
~

回答by knittl

Assuming the editor in use is VI(M): hit escto leave insert mode, then :wqto save and quit

假设使用的编辑器是 VI(M):点击esc离开插入模式,然后:wq保存并退出

回答by Noufal Ibrahim

You edit it in the same way as you would edit a commit message. If you're not comfortable with the default editor, change it using the EDITORenvironment variable. Also, you can directly edit your configuration file using an editor of your choice.

您可以像编辑提交消息一样编辑它。如果您对默认编辑器不满意,请使用EDITOR环境变量更改它。此外,您可以使用您选择的编辑器直接编辑您的配置文件。