SSH KEY Already Exists Bitbucket

夙愿已清 提交于 2019-12-08 14:10:57

问题


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 ?


回答1:


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 the user1.
  • Pushing to same repo, but with bitbucket2:repoA will use the user2.


来源:https://stackoverflow.com/questions/32773988/ssh-key-already-exists-bitbucket

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!