【发布时间】:2019-09-23 05:42:05
【问题描述】:
我尝试使用使用私钥的方法(具有密码并从文件添加到 ssh-agent)(根据this stack post):
spring:
cloud:
config:
server:
git:
uri: git@github.com-forApp:myorg/myrepo.git
search-paths: '{application}'
clone-on-start: true
private_key_file: ~/.ssh/id_rsa
但我不断得到
org.eclipse.jgit.api.errors.TransportException: git@github.com:myorg/myrepo.git: USERAUTH 失败
我是否必须像doc says 那样将密钥粘贴到配置文件中,还是只能以某种方式指向密钥文件?
编辑
实际上,private_key_file 根本不需要或被 Spring 忽略。但是你需要 ~/.ssh/config 部分指向私钥才能使用:
Host github.com-forApp # used in spring uri
HostName github.com
User git
IdentityFile ~/.ssh/gitHubKey
【问题讨论】:
-
你配置你的 github 来接受你的 ssh 密钥了吗?
-
@BurakAkyıldız 是的,例如,当我使用 git 时,它使用我的 ssh 密钥,无需登录/密码
标签: spring-boot github spring-cloud spring-cloud-config