Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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.

like image 332
Dan Ross Avatar asked May 27 '13 22:05

Dan Ross


People also ask

Can I edit git config file?

The global git config is simply a text file, so it can be edited with whatever text editor you choose. Open, edit global git config, save and close, and the changes will take effect the next time you issue a git command. It's that easy.

What is git reset command?

Summary. To review, git reset is a powerful command that is used to undo local changes to the state of a Git repo. Git reset operates on "The Three Trees of Git". These trees are the Commit History ( HEAD ), the Staging Index, and the Working Directory.


1 Answers

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 
like image 134
mvp Avatar answered Oct 09 '22 11:10

mvp