I have two github accounts, one personal and one for work. I like to keep my work account clean, so if I need to patch an upstream project, I use my personal account.
First, setup a second SSH key
ssh-keygen -t rsa -b 4096 -f ~/.ssh/github-mypersonalgh
Add the github-mypersonalgh.pub
to Github (in Settings/SSH and GPG keys)
Add some magic to your .ssh/config
file:
Host github.com
User git
IdentityFile ~/.ssh/id_rsa
Host github.com-mypersonalgh
HostName github.com
User git
IdentityFile ~/.ssh/github-mypersonalgh
Then clone with a special remote url:
git clone github.com-mypersonalgh:mypersonalgh/project.git
Finally, inside the project, set the local config
git config user.name "My Name"
git config user.email "[email protected]"