问题说明
配置 Spring Cloud Config Server 时,spring.cloud.config.git.uri 用的是 ssh 的方式,结果报了如下异常,提示未知的git所在服务器的 HostKey 不在本地~/.ssh/known_hosts 列表里
1 | 2018-05-22 15:59:03.054 ERROR 32067 --- [nio-8085-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 |
解决方案
打开命令行,执行以下命令即可:1
ssh-keyscan -t rsa {hostname or IP} >> ~/.ssh/known_hosts