Git:我不小心改变它后,如何重置一个配置参数? [英] Git: How can I reset a config parameter after I have accidentally changed it?

查看:1147
本文介绍了Git:我不小心改变它后,如何重置一个配置参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在bash中使用tab完成了 git config 选项,并且没有真正想到,我这样做了:

I was exploring the git config options using tab completion in bash, and without really thinking, I did this:

git config --global user.signingkey --help



<现在我的全局签名密钥被设置为 --help 。捂脸。有没有一种通用的方法来找出这些配置设置在过去的什么地方,或者有什么地方可以在项目中查看,看看可能设置了什么?我有一个Github帐户,也许我可以从那里获得旧的价值,因为我从错误以来没有推过任何东西?我甚至不确定它是否设置了任何内容,但我使用SSH与Github。

and now my global signing key is set to --help. Facepalm. Is there a generic way to find out what these config settings where in the past, or is there somewhere that I could look in a project to see what this might have been set to? I have a Github account, maybe I could get the old value from there, since I haven't pushed anything since the mistake? I'm not even sure if it was set to anything, but I do use SSH with Github.

cd <another project's location>; git config user.signingkey

返回 - help

推荐答案

命令

Command

git config --global section.key value

无非是编辑文件〜/ .gitconfig ,内容如下:

does nothing more than editing file ~/.gitconfig with content like this:

[section]
key = value

所以,你可以简单地编辑这个文件并修复它。

So, you can simply edit this file and fix it.

另外,您可以使用命令删除违规设置:

Also, you can use command to remove offending setting:

git config --global --unset section.key

这篇关于Git:我不小心改变它后,如何重置一个配置参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆