当前位置: 首页 > 知识库问答 >
问题:

spring配置服务器git ssh unknownhostkey

晏望
2023-03-14

我部署了SpringCloudConfigServer,通过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 stash中。我还添加了/。带有StrictHostKeyChecking无选项的ssh/config文件。但当我访问配置服务器时,仍然会出现此错误。

[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

通用域名格式。jcraft。jsch。JSchException:UnknownHostKey:stash。行动计划。领域通用域名格式。RSA密钥指纹在com上是39:89:4b:aa:79:fc:01:9f:46:48:5b:b9:6f:17:af:d5。jcraft。jsch。一场在com上检查主机(Session.java:786)。jcraft。jsch。一场在org上连接(Session.java:342)。日食jgit。运输JschConfigSessionFactory。位于org的getSession(JschConfigSessionFactory.java:116)。日食jgit。运输SSHTTransport。getSession(sshttransport.java:136)位于org。日食jgit。运输TransportGitsh$SshFetchConnection。(transportGitsh.java:262)位于org。日食jgit。运输我是宋承宪。org上的openFetch(transportgitsh.java:161)。日食jgit。运输获取过程。org上的executeImp(FetchProcess.java:136)。日食jgit。运输获取过程。在org上执行(FetchProcess.java:122)。日食jgit。运输运输在org上获取(Transport.java:1115)。日食jgit。应用程序编程接口。获取命令。在org上调用(FetchCommand.java:130)。日食jgit。应用程序编程接口。CloneCommand。在org上获取(CloneCommand.java:178)。日食jgit。应用程序编程接口。CloneCommand。在org上调用(CloneCommand.java:125)。springframework。云配置。服务器JGitEnvironmentRepository。cloneToBasedir(JGitEnvironmentRepository.java:265)位于org。springframework。云配置。服务器JGitEnvironmentRepository。copyRepository(JGitEnvironmentRepository.java:237)

共有1个答案

劳和歌
2023-03-14

我遇到了确切的问题。我提出的解决方案(我使用的)是一个黑客,但对我有效。只要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。添加后,您将不再获得该错误。

 类似资料:
  • 我一直在尝试掌握位于此处的spring boot config服务器:https://github.com/spring-cloud/spring-cloud-config在更彻底地阅读了文档之后,我能够解决我的大部分问题。然而,我不得不为基于文件的PropertySourceLocator编写一个额外的类 然后我将其添加到ConfigServiceBootstrapConfiguration.j

  • 我正在使用Spring Cloud Config服务器,能够检测来自git存储库的更改并将其传递给配置客户机。 有两种方法,我已经实现了: null 所以两者都工作得很好,那么使用Spring Cloud Bus有什么好处吗?或者在生产环境中,不使用Spring Cloud Bus会有什么问题吗?因为将需要额外的工作来设置RabbitMQ集群(HA)作为生产中的Spring云总线。 谢谢,大卫

  • 我们来看看如何配置服务器端的 SSH 访问。 本例中,我们将使用 authorized_keys 方法来对用户进行认证。 同时我们假设你使用的操作系统是标准的 Linux 发行版,比如 Ubuntu。 首先,创建一个操作系统用户 git,并为其建立一个 .ssh 目录。 $ sudo adduser git $ su git $ cd $ mkdir .ssh && chmod 700 .ssh

  • 服务器配置 当你需要一台服务器的时候,首先需要向你的leader 提出申请,你的 leader 会利用公司的阿里云账户购买服务器实例,并且会把服务器的公网IP以及账号密码发送给你。 以下章节就叙述了当拿到一台全新的阿里云服务器实例时,我们需要怎样的工具以及我们需要经历哪些步骤对服务器进行配置。

  • 我目前正在尝试使用Spring云配置,并且我无法让Spring云配置服务器从我的github存储库加载属性。我一直在关注这里的文档: http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_spring_cloud_config_server 这是我的Mavenpom.xml文件: 这是我的应用课程: 这是我的app

  • 我正在尝试创建SpringCloudConfigServer,以便使用SSHURI连接到git存储库(bitbucket)。我正在关注Spring云配置 我使用ssh-keygen实用工具生成了密钥对,并粘贴了。发布文件内容在我的bitbucket帐户的ssh部分,但当我运行作为spring启动应用程序的服务器时,我得到无效的privateKey异常。 我也使用了这个堆栈溢出帖子中提供的建议,但是