"Someone has already registered that SSH key." - of course I have, not a crime to have two accounts you know. @bitbucket @github
— Tim Pizey (@timPizey) November 26, 2015
The problem I have is that I have multiple accounts with git hosting suppliers (github and bitbucket) but they both want to keep a one to one relationship between users and ssh keys.
For both accounts I am separating work and personal repositories.
Github
BitBucket
In the past I have authorised all my identities on all my repositories, this has resulted in multiple identities being used within one repository which makes the statistics look a mess.
The Solution
Generate an ssh key for your identity and store it in a named file for example ~/.ssh/id_rsa_timp.
Add the key to your github or bitbucket account.
Use an ssh config file ~/.ssh/config
Host bitbucket.timp
HostName bitbucket.com
User git
IdentityFile ~/.ssh/id_rsa_timp
IdentitiesOnly=yes
You should now be good to go:
git clone git@bitbucket.timp:timp/project.git
Update .git/config
[remote "bitbucket"]
url = git@bitbucket.timp:timp/wiki.git
fetch = +refs/heads/*:refs/remotes/bitbucket/*
No comments:
Post a Comment