Reputation: 1101
For the 2 multiple projects, 2 multiple bitbucket developer accounts are used but in the same machine. SSH KEY is accepted for the one Bitbucket account.
When I add the same key to the other bit bucket accounts, It shows KEY already exists ?
How could I avoid this problem ? Is there a security reasons behind this ?
It accepts the same key in Gitlab Note: Currently we are using HTTPS connection for other accounts ?
Upvotes: 2
Views: 8245
Reputation: 1326676
How could I avoid this problem? Is there a security reason behind this?
Yes: if a public key is registered in a Bitbucket account, that means any git operation using that SSH URL would be associated with that account.
Registering the same public SSH key to a different account would mean having to choose between two Bitbucket user accounts. That is not possible.
What you can do is create a different public/private couple of SSH keys, and reference one or the other Bitbucket account, by declaring both sets of SSH keys in an ~/.ssh/config
file.
See "How to use different keys for different Bitbucket repos in SmartGit?"
host bitbucket1
user git
hostname bitbucket.org
port 22
identityfile /C/path/to/.ssh/key1
host bitbucket2
user git
hostname bitbucket.org
port 22
identityfile /C/path/to/.ssh/key2
Then:
bitbucket1:repoA
will use the user1
.bitbucket2:repoA
will use the user2
.Upvotes: 3