如何在SmartGit中为不同的Bitbucket回购使用不同的密钥? [英] How to use different keys for different Bitbucket repos in SmartGit?

查看:151
本文介绍了如何在SmartGit中为不同的Bitbucket回购使用不同的密钥?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用 SmartGit 作为SSH客户端时,它会缓存第一个选定的密钥。当进一步尝试推/推到另一个回购时,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 a key1 (private) and key1.pub (public) ssh files (same for key2/key2.pub)

这篇关于如何在SmartGit中为不同的Bitbucket回购使用不同的密钥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆