如何在SmartGit中为不同的Bitbucket回购使用不同的密钥?

时间:2015-09-01 05:49:12

标签: git macos ssh smartgit

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

SmartGit会将首选项保存到首选项以连接到Bitbucket。但是所有repos都在SmartGit首选项中有地址ssh://git@bitbucket.org

1 个答案:

答案 0 :(得分:2)

作为mentioned herethis thread,您应该能够reference multiple private ssh keys in a %HOME%\.ssh\config file,将网址更改为bitbucket2:userA/myrepo2%HOME%\.ssh\config file

这意味着:

  • 您已在首选项中选择了系统SSH
  • 添加了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(私有)和key2(公开)ssh文件(key2.pub / {{1}}相同)
相关问题