相关疑难解决方法(0)

USERAUTH失败,Github和Spring云配置的私钥文件

我试图使用使用私钥的方法(具有密码短语,并且已从文件添加到ssh-agent中)(根据堆栈文章):

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
Run Code Online (Sandbox Code Playgroud)

但我不断

org.eclipse.jgit.api.errors.TransportException:git@github.com:myorg / myrepo.git:USERAUTH失败

将密钥粘贴到配置文件中时,我是否必须完全按照doc所述进行操作,还是可以以某种方式仅指向密钥文件?

编辑

实际上,事实证明private_key_file根本不需要或Spring忽略了。但是您需要使用~/.ssh/config指向私钥的部分:

Host github.com-forApp # used in spring uri 
       HostName github.com
       User git
       IdentityFile ~/.ssh/gitHubKey
Run Code Online (Sandbox Code Playgroud)

github spring-boot spring-cloud spring-cloud-config

6
推荐指数
1
解决办法
616
查看次数