首页 > 解决方案 > Spring Cloud Config - 无法克隆或签出存储库:ssh://git@github.com//repo.git

问题描述

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

{
"error": "Not Found",
"message": "Cannot clone or checkout repository: ssh://git@github.com/<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://git@github.com/<user>/config-repo.git
          searchPaths: licensingservice

我正在使用弹簧云配置 - Finchley.Not。不知道我错过了什么。请建议。

标签: spring-cloud-config

解决方案


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

应使用以下命令生成 SSH 密钥: ssh-keygen -m PEM -t rsa -b 4096 -C "your_email@example.com"

有关更多信息,您可以查看此链接

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


推荐阅读