Skip to content

Instantly share code, notes, and snippets.

@litvil
Created January 24, 2019 19:55
Show Gist options
  • Save litvil/6a52735784843be7e072c9b7b287221b to your computer and use it in GitHub Desktop.
Save litvil/6a52735784843be7e072c9b7b287221b to your computer and use it in GitHub Desktop.
Two Git accounts ssh config
In ~/.ssh/ create a file called config with contents based on this:
#user1 account
Host bitbucket.org-user1
HostName bitbucket.org
User git
IdentityFile ~/.ssh/user1
IdentitiesOnly yes
#user2 account
Host bitbucket.org-user2
HostName bitbucket.org
User git
IdentityFile ~/.ssh/user2
IdentitiesOnly yes
Replace user1 or user2 with your Bitbucket usernames
Generate key with:
ssh-add -K ~/.ssh/user1.rsa
Set remote with:
git remote set-url origin [email protected]:user1/your-repo-name.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment