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:)
I think setting up different hosts in SSH config is a better way to manage SSH keys.
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 logsI use direnv for example for setting per-directory Perl installation variables to keep my development environments separate.