问题描述
对于2个多个项目,使用2个多个bitbucket开发人员帐户,但在同一台计算机上。
SSH KEY被一个Bitbucket帐户接受。
当我将相同的密钥添加到其他位存储桶帐户时,它显示KEY已经存在?
我怎样才能避免这个问题?
是否存在安全原因?
它在Gitlab中接受相同的密钥
注意:目前我们使用的是HTTPS连接对于其他账户?
是:如果公钥在BitBucket帐户中注册,则表示使用任何git操作该ssh url将与该帐户关联。
将同一公钥ssh注册到不同的帐户将意味着必须在两个Bitbucket用户帐户。这是不可能的。
你可以做的是创建一个不同的公钥/私钥对,并引用一个或另一个Bitbucket账户,通过声明两组ssh键在〜/ .ssh / config
文件中。
请参阅
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
然后:
- 推送至
bitbucket1:repoA
将使用user1
。 - 推入相同的仓库,但使用
bitbucket2:repoA
将使用user2
。
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 GitlabNote: Currently we are using HTTPS connection for other accounts ?
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
.
这篇关于SSH密钥已经存在Bitbucket的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!