Generate a new SSH Key then Add the key to your second GitHub account
In ~/.ssh/config
, add a custom host for your additional user
Host github.com-otheruser
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_otheruser
cd
into your repository and configure the remote to point to your specified host.
cd myproject
git remote set-url git@github.com-otheruser:otheruser/myproject.git
Additionally, you can configure a different Name and Email for this repository.
git config user.name "Other User"
git config user.email "myemail@example.com"