'Multiple ssh keys for multiple accounts on bitbucket/github, not working
I'm having trouble trying to get this work even though there's ton of questions on this topic. Either I'm missing something or they're not what I want.
I have two accounts on github - account1 and account2 with their respective repositories
[email protected]:account1/repo.git
[email protected]:account2/repo.git
On my PC I've created 2 separate SSH keys for each one account1_id_rsa and account1_id_rsa
They both individually work when I name them just id_rsa and by default it all works. But I want to be able to keep they keys named account1_id_rsa and account1_id_rsa and still be able to push/pull without having to rename each one depending on which repo I wanna work on at the moment.
After reading many QAs on the topic, I still can't figure out what to put in my .ssh\config. So far I've tried
Host bitbucket
HostName bitbucket.org
IdentityFile ~/.ssh/account2_id_rsa
User account2
Host bitbucket
HostName bitbucket.org
IdentityFile ~/.ssh/account1_id_rsa
User account1
Solution 1:[1]
Found the answer here
http://kevinpelgrims.com/blog/2012/07/19/setting-up-multiple-github-accounts-on-windows
Host account1.bitbucket
HostName bitbucket.org
IdentityFile ~/.ssh/account1_id_rsa
Host account2.bitbucket
HostName bitbucket.org
IdentityFile ~/.ssh/account2_id_rsa
And most importantly, I needed to have the following git URLs
[email protected]:repo.git
[email protected]:repo.git
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | laggingreflex |
