USERAUTH fail with private key file for Github and Spring cloud config

我与影子孤独终老i 提交于 2019-12-05 06:09:57

I was able to replicate your behavior and resolved it with following. Let me know your thoughts.

USERAUTH fail is happening because you are not providing the passphrase for the RSA private key.(password for Basic Auth and passphrase for ssh private key)

spring:
  cloud:
    config:
      server:
        git:
          uri: git@github.com:myorg/myrepo.git
          search-paths: '{application}'
          clone-on-start: true
          passphrase: myprivatekeypassword

If you are not comfortable with keeping private key password in config then you can regenerate RSA key without passphrase but I am not sure whether it meets your security requirement.

By default ~/.ssh/id_rsa is sent during GIT SSH Authentication(Test with command ssh -vT git@github.com. You don't need to specify it in configuration. Also, I am not sure whether private_key_file works or not, since I don't see any official documentation for it.

If you have different named RSA file under .ssh then I would advise to create config file under ~/.ssh/config with github host details and identify file.

Here is one example.

Host github.com
    IdentityFile ~/.ssh/mygitid_rsa

Check this stack answer for more details which desired the configuration providing private key file path within config.

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