

Show HN: Karn – Manage multiple Git identities - prydonius
https://github.com/prydonius/karn

======
mlawren
A more generic tool for this type of function is
direnv[[http://direnv.net/](http://direnv.net/)].

I use direnv for example for setting per-directory Perl installation variables
to keep my development environments separate.

~~~
ethomson
From my (admittedly brief) glance at the documentation, this seems like the
opposite of direnv. direnv would allow you to set up configuration values on a
per-directory basis, by adding a file in the directory in question. git
supports this already, you can simply change the config for the repository in
question. The goal of this package appears to automate this so that one
doesn't need to reconfigure each individual folder.

------
cakey
This will definitely be useful for helping switch between work and personal
projects on the same laptop!

------
32bitkid
I don't mean to be a fuddy-duddy, but I don't get it... How is this
better/worse than doing...

    
    
            git config user.name Foobar
            git config user.email foo@bar.com
    

...which will set that config variable for the current repository only -- not
global. I ended up do the a similar thing for a simple git pairing tool[1]
that would let you set your name to two people, so that one could discern the
pair from the commit logs

[1]:[https://github.com/32bitkid/git-working-
with](https://github.com/32bitkid/git-working-with)

~~~
prydonius
I built karn to avoid situations where I've forgotten to update the config
after cloning a new repository. With karn, any repository under `~/Work`, for
example, will automatically be configured to use the correct identity. Also,
since it's all in one configuration file, that makes it really easy to
maintain and keep it in sync with multiple machines.

------
mrdrozdov
Does this handle management of SSH keys?

~~~
hliyan
I already do this with a simple shell script:

    
    
      if [ $1 == "home" ]; then
            ssh-add -D
            ssh-add ~/.ssh/id_rsa_home
            ssh -T git@github-home
            exit;
      fi
    

where in ~/.ssh/config:

    
    
      Host github-home
        HostName github.com
        User git
        IdentityFile ~/.ssh/id_rsa_home
        IdentitiesOnly yes

~~~
cies
I also have stuff like this lying around. Please don't tell Github because I
seem to remember it is against their policy.

:)

~~~
hliyan
Actually they're okay with it. I checked with them about how to do this and
they recommended a single account instead. When I said I needed to keep my
corporate and personal accounts separate for policy reasons, they were fine
with it.

------
machinshin_
heh. the last time i saw this implemented, it was called gas =>
[https://github.com/walle/gas](https://github.com/walle/gas)

