Issue
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 ?
Solution
How could I avoid this problem ? Is there a security reasons 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 to that account.
Registering the same public ssh key to a different account would mean having to chose between two Bitbucket users account. 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:
- Pushing to
bitbucket1:repoA
will use theuser1
. - Pushing to same repo, but with
bitbucket2:repoA
will use theuser2
.
Answered By - VonC Answer Checked By - Robin (WPSolving Admin)