Using git config to fix settings and stuff

I am a bit of a git noob so I had to poke around a bit to figure out how to fix my user.email setting. Here are some snippets of useful git config commands and options to illustrate behavior.

Initialize empty git repo in dummy directory:


$ git init

Initialized empty Git repository in /home/mrmagoo/foogit/.git/

List all config items. These were created automatically when we executed the git init command because at some point in the past I had set them using git config --global --add:


$ git config -l

user.name=Mr Magoo
user.email=mr.magoo@mrmagoo.com
push.default=simple
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true

Remove the user.email global setting:


$ git config --global --unset user.email

$ git config -l

user.name=Mr Magoo
push.default=simple
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true

Re-add the user.email global setting but give it a different value this time:


$ git config --global --add user.email mr.magoo@gmail.com

$ git config -l

user.name=Mr Magoo
user.email=mr.magoo@gmail.com
push.default=simple
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true

Add a local user.email setting:


$ git config --add user.email mr.magoo@yahoo.com

$ git config -l

user.name=Mr Magoo
user.email=mr.magoo@gmail.com
push.default=simple
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
user.email=mr.magoo@yahoo.com

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s