Phil CK

Git - Local Config

Last updated on

Often on a work machine I might do some hobby work, but I don’t really want the work Git config in my history.

% git config user.email
you@workemail.com

If you are on a nix type machine you can see the config here.

% cat ~/.gitconfig
[user]
  name = Your Name
  email = you@workemail.com
[core]
  repositoryformatversion = 0
  etc ...

There is a way around this that might be quite useful, for one off checkouts like a blog or some lunchtime practice.

git clone your_hobby_repo
cd your_hobby_repo
cd .git
cat config

Here you can see the config setting for this local repo. You can edit this file and add a user setting.

[user]
  name = Your Name
  email = you@personal.com

Now when you call git config user.email you should see your personal email address.