【问题标题】:How to use different keys for different Bitbucket repos in SmartGit?如何在 SmartGit 中为不同的 Bitbucket 存储库使用不同的密钥?
【发布时间】:2015-09-01 05:49:11
【问题描述】:

当使用 SmartGit 作为 SSH 客户端时,它会缓存第一个选择的密钥。当你进一步尝试拉/推到另一个仓库时,SmartGit 会说"Access denied"

SmartGit 将用于连接 Bitbucket 的密钥保存到首选项中。但所有 repos 都有地址:ssh://git@bitbucket.org 在 SmartGit 首选项中。

【问题讨论】:

    标签: git macos ssh smartgit


    【解决方案1】:

    作为mentioned herethis thread,你应该可以reference multiple private ssh keys in a %HOME%\.ssh\config file,将url更改为bitbucket1:userA/myrepo1bitbucket2:userA/myrepo2

    这意味着:

    • 您已在首选项中选择了系统 SSH
    • 添加了%HOME%\.ssh\config file

    配置:

    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
    
    • /C/path/to/.ssh/ 中,您有一个key1(私有)和key1.pub(公共)ssh 文件(key2/key2.pub 相同)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-13
      相关资源
      最近更新 更多