
Using Multiple Author Identities with Git - seriousTrig
http://www.thecodedself.com/Using-Multiple-Author-Identities-With-Git/
======
eliaspro
I always wondered why git doesn't support hierarchic config locations… My
homedir looks like this:

    
    
      ~/code-repositories/
         +---$company/ (my work related repositories)
         +---private/  (my personal non-public repos)
         +---public/   (my clones of public FLOSS repos)
    
    

So I'd simply like to drop a `.gitconfig` with the default user for all repos
below this location into each of those 3 directories, but instead I have to
make sure for every freshly clone/initiated repo to configure the author etc.

------
pseud
I use Karn for this:
[https://github.com/prydonius/karn](https://github.com/prydonius/karn)

------
tomyws
I only recently discovered the local "current repository" configuration
option, but I still need to verify which identity I'm using before a commit.

It makes sense not to set the global config at all if you're paranoid. This
ensures you have to setup the user.name and user.email locally.

~~~
sigsergv
There is also extremely useful option user.useConfigOnly, it was added
recently though. Before 2.8 (iirc) you had to use weird hack "git config
--global user.email '(none)'"

------
rlpb
I'm forever using the wrong hat when making commits, because I don't keep all
my repositories local but clone when needed.

I keep intending to make a wrapper around "git init" and "git clone" warning
me of what my identity is, so I have the opportunity to change it.

Karn looks interesting (thanks pseud!) but unfortunately won't work for me
because I often use /tmp and not any consistent path naming that would
identify which hat I should be using.

------
lebanon_tn
Thanks for this. I had assumed there is a way to do this but had never gotten
around to setting it up since I use different machines altogether for personal
and work projects.

