Skip to content

Instantly share code, notes, and snippets.

@kylemacey
Created December 2, 2017 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylemacey/96a725a0659ad62ab7025246d59f80fd to your computer and use it in GitHub Desktop.
Save kylemacey/96a725a0659ad62ab7025246d59f80fd to your computer and use it in GitHub Desktop.

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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment