如何在SmartGit中为不同的Bitbucket回购使用不同的密钥? [英] How to use different keys for different Bitbucket repos in SmartGit?
问题描述
拒绝访问
。 SmartGit保存以选择连接到Bitbucket时使用的密钥。但是所有回购都在SmartGit首选项中提供了 ssh://git@bitbucket.org
。
由于此处提及和 this thread ,你应该是能够在%HOME%\.ssh\config文件中引用多个专用ssh密钥
,将url更改为 bitbucket1:userA / myrepo1
, bitbucket2:userA / myrepo2
。
这意味着:
%HOME%\.ssh\config文件
:
config:
主机bitbucket1
用户git
主机名bitbucket.org
端口22
标识文件/C/path/to/.ssh/key1
主机bitbucket2
用户git
主机名bitbucket.org
端口22
标识文件/在<$ c中使用C / path / to / .ssh / key2
- $ c> /C/path/to/.ssh/ ,你有一个
key1
(私有)和key1。 pub
(public)ssh文件(对于key2
/key2.pub
)相同) li>
When using SmartGit as SSH-client, it caches the first selected key. And when further you trying to pull/push to another repo, SmartGit says "Access denied"
.
SmartGit saves to preferences what key should it use to connect to the Bitbucket. But all repos has address: ssh://git@bitbucket.org
in SmartGit preferences.
As mentioned here and in this thread, you should be able to reference multiple private ssh keys in a %HOME%\.ssh\config file
, changing the url to bitbucket1:userA/myrepo1
, bitbucket2:userA/myrepo2
.
That means that:
- you have selected System SSH in the preferences
- have added a
%HOME%\.ssh\config file
with:
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
- in
/C/path/to/.ssh/
, you have akey1
(private) andkey1.pub
(public) ssh files (same forkey2
/key2.pub
)
这篇关于如何在SmartGit中为不同的Bitbucket回购使用不同的密钥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!