更新时间:2022-06-26 09:39:06
终于成功了!
这个问题:How to use a custom ssh key location with Spring Cloud Config给我指明了正确的方向。我调试了JschConfigSessionFactory
类,发现当未提供用户名和密码时,它会从~/.ssh/config
中的默认配置文件获取配置。
因此,我所要做的就是将以下内容添加到我的~/.ssh/config文件中:
Host bitbucket.org
User TarekSaid
Hostname bitbucket.org
PreferredAuthentications publickey
IdentitiesOnly yes
IdentityFile ~/.ssh/bitbucket_rsa
现在可以工作了。