How to use different keys for different Bitbucket repos in SmartGit?

一个人想着一个人 提交于 2019-12-23 01:18:06

问题


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.


回答1:


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)


来源:https://stackoverflow.com/questions/32324376/how-to-use-different-keys-for-different-bitbucket-repos-in-smartgit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!