I use several github accounts, and wanted a way to use them without constantly tweaking remote urls and stuff for each repo.
The good news is at some point, it seems git started to traverse directories upwards, looking for
.gitconfig files. So it makes it easy to setup several directories, each of which uses different credentials automatically.
So, for my voboda account on github:
mkdir ~/repos/voboda cd ~/repos/voboda
And there I added a
.gitconfig file containing:
[core] sshCommand = ssh -i ~/.ssh/id_rsa_voboda [user] name = Voboda email = email@example.com
Now, anything I need to work on in my voboda account, I just clone that under the ~/repos/voboda directory. For example
~/repos/voboda/underlinery. Both will use the above user information automatically. That specific ssh command references the ssh key I setup for my
voboda github account.
On Linux, I setup that ssh key using
ssh-keygen -f id_rsa_voboda and then copying the 2 outputted keyfiles to my