Dan Ross
Dan Ross

Reputation: 3691

Git: How can I reset a config parameter after I have accidentally changed it?

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

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

returns --help.

Upvotes: 30

Views: 47506

Answers (1)

mvp
mvp

Reputation: 116048

Command

git config --global section.key value

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

Upvotes: 59

Related Questions