top | item 9463529

Show HN: Karn – Manage multiple Git identities

33 points| prydonius | 11 years ago |github.com | reply

13 comments

order
[+] mlawren|11 years ago|reply
A more generic tool for this type of function is direnv[http://direnv.net/].

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

[+] ethomson|11 years ago|reply
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|11 years ago|reply
This will definitely be useful for helping switch between work and personal projects on the same laptop!
[+] 32bitkid|11 years ago|reply
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 [email protected]
...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

[+] prydonius|11 years ago|reply
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.
[+] detaro|11 years ago|reply
It stops you from forgetting to do that. Especially for small, quick things like spell-fix PRs to random github projects it has happened to me that I forgot to set the right user before making and publishing commits.
[+] mrdrozdov|11 years ago|reply
Does this handle management of SSH keys?
[+] hliyan|11 years ago|reply
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
[+] prydonius|11 years ago|reply
The focus of karn right now is to manage repository-level configuration.

I think setting up different hosts in SSH config is a better way to manage SSH keys.

[+] kbody|11 years ago|reply
I was hoping that as well, that's the main challenge with multiple identities, but it seems it's not included on karn :(