【问题标题】:spring config server git ssh unknownhostkeyspring 配置服务器 git ssh unknownhostkey
【发布时间】:2017-04-26 18:34:55
【问题描述】:

我部署了 Spring 云配置服务器以通过 ssh 连接到 git 存储库。

spring:
  cloud:
    config:
      server:
        git:
          uri: ssh://git@stash.ops.domain.com:2022/ccare/cm-config-data.git
          searchPaths: [preferences, orders]

我已将 ssh 密钥 (id_rsa.pub) 添加到 Git 存储区。 我还添加了 /.ssh/config 文件,没有 StrictHostKeyChecking 选项。 但是当我访问配置服务器时,我仍然不断收到此错误。

[nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: Cannot clone or checkout repository] with root cause

com.jcraft.jsch.JSchException:UnknownHostKey:stash.ops.domain.com。 RSA 密钥指纹为 39:89:4b:aa:79:fc:01:9f:46:48:5b:b9:6f:17:af:d5 在 com.jcraft.jsch.Session.checkHost(Session.java:786) 在 com.jcraft.jsch.Session.connect(Session.java:342) 在 org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:116) 在 org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:136) 在 org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.(TransportGitSsh.java:262) 在 org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:161) 在 org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136) 在 org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122) 在 org.eclipse.jgit.transport.Transport.fetch(Transport.java:1115) 在 org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130) 在 org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:178) 在 org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:125) 在 org.springframework.cloud.config.server.JGitEnvironmentRepository.cloneToBasedir(JGitEnvironmentRepository.java:265) 在 org.springframework.cloud.config.server.JGitEnvironmentRepository.copyRepository(JGitEnvironmentRepository.java:237)

【问题讨论】:

    标签: spring ssh


    【解决方案1】:

    我遇到了确切的问题。我提出的解决方案(我使用的)是一个 hack,但对我有用。只是ssh那个服务器

    ssh stash.ops.domain.com
    

    你会得到如下提示:

    The authenticity of host 'stash.ops.domain.com' can't be established.
    RSA key fingerprint is <fingerprint>
    Are you sure you want to continue connecting (yes/no)?
    

    如果您说yes,那么stash.ops.domain.com 将被添加到known_hosts。 添加后,您将不再收到该错误。

    【讨论】:

    猜你喜欢
    • 2018-09-26
    • 2018-04-08
    • 2019-05-15
    • 1970-01-01
    • 2020-04-16
    • 2014-12-20
    • 2017-09-07
    • 2015-06-02
    • 2016-04-10
    相关资源
    最近更新 更多