Working against different GitHub accounts is easy if each project you work with on each account adds you as a collaborator. The term "you" here means your primary username on GitHub. My strong recommendation is to always check out a project using your primary GitHub username.
Occasionally you want to create a new GitHub account, say for a project XYZ
.
For such a non-personal account, do not provide an SSH key of any
particular user. The reason is that this user will then get two
GitHub identities, and switching between these identities will require
some special tweakings. Just forget about the SSH key for a project
account and add
collaborators to repos using each collaborators personal GitHub username.
If you really need to operate the XYZ
account as a
personal account, you must provide an SSH key that is different from
any other key at any other GitHub account (you will get an error message
if you try to register an already registered SSH key, but it is possible to
get around the error message by providing
an id_rsa.pub
key on one account and an id_dsa.pub
on another - that
will cause trouble). Jeffrey Way has written a recipe for how to operate multiple GitHub accounts
using multiple identities.
To debug which identity that is used when you pull and push to GitHub accounts, you can first run
Terminal> ssh -Tv git@github.com
to see your current identity and which SSH key that was used to identify you. Typing
Terminal> ssh-add -l
lists all your SSH keys. The shown strings can be compared with the string in the SSH key field of any GitHub account.