Spring Cloud Config - 无法克隆或签出存储库:ssh://[email protected]/<user>/repo.git

问题描述 投票:0回答:3

当我尝试使用

https
的 URL 时,它可以工作,但我不想拥有用户名和密码。我能够使用上面的 url 及其工作原理执行 git 克隆。但是当我在代码中尝试并点击 localhost:8888/default 端点时,我收到错误:

{
"error": "Not Found",
"message": "Cannot clone or checkout repository: ssh://[email protected]/<user>/config-repo.git",
"path": "/licensingservice/default",
"status": 404,
"timestamp": "2018-04-30T23:32:54.726+0000"
}

这是我的 application.yml 条目

server:
  port: 8888
spring:
  cloud:
    config:
      server:
        git:
          uri: ssh://[email protected]/<user>/config-repo.git
          searchPaths: licensingservice

我正在使用 Spring Cloud 配置 - Finchley.Not。不知道我错过了什么。请推荐。

spring-cloud-config
3个回答
0
投票

需要检查的事情很少:

  1. 你的known_hosts中有github吗?如果没有,那么即使您有可能导致错误的密钥对,它也会提示您输入密码。
  2. 您在 /home/{you}/.ssh/ 文件夹下有 SSH 密钥吗?
  3. 当您生成密钥时,您是否使用了密码?如果是这样,您需要在 YAML 文件中包含
    passphrase
    键。

如果以上都没有问题的话。然后下载spring-cloud-config-server,调试

org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.class

祝你好运。


0
投票

您必须将机器的 ssh 密钥添加到存储库中。

Ssh 密钥应使用以下命令生成: ssh-keygen -m PEM -t rsa -b 4096 -C“[电子邮件受保护]

欲了解更多信息,您可以查看此链接

https://skryvets.com/blog/2019/05/27/solved-issue-spring-cloud-config-server-private-ssh-key/


-1
投票

我在 Spring Cloud 配置服务器上也遇到了类似的问题。您需要在 application.properties 文件中添加额外的属性

spring.cloud.config.server.git.skip-ssl-validation=true

© www.soinside.com 2019 - 2024. All rights reserved.