且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Spring Cloud Config无法使用ssh密钥克隆私有Bitbucket存储库

更新时间:2022-06-26 09:39:06

终于成功了!

这个问题:How to use a custom ssh key location with Spring Cloud Config给我指明了正确的方向。我调试了JschConfigSessionFactory类,发现当未提供用户名和密码时,它会从~/.ssh/config中的默认配置文件获取配置。

因此,我所要做的就是将以下内容添加到我的~/.ssh/config文件中:

~/.ssh/config

Host bitbucket.org
  User TarekSaid
  Hostname bitbucket.org
  PreferredAuthentications publickey
  IdentitiesOnly yes
  IdentityFile ~/.ssh/bitbucket_rsa

现在可以工作了。