如何将github存储库配置为Spring Cloud Server的配置存储库? [英] How to configure a github repository as a config repo for spring cloud server?

查看:131
本文介绍了如何将github存储库配置为Spring Cloud Server的配置存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个github存储库https://github.com/Nisarg04/microservices-config-repo.git,我希望将其视为配置存储库.另外,我有一个Spring Cloud Server,它从本地存储库中选择属性(按照当前配置).我希望从github回购中选择.
application.properties看起来像这样:

I have created a github repository https://github.com/Nisarg04/microservices-config-repo.git, which I want to be treated as a config repo. Also, I have a spring cloud server, which picks properties from local repo (as per current configuration). I want that to be picked from github repo.
application.properties looks something like this :

spring.application.name=spring-cloud-config-server
server.port=8888
#spring.cloud.config.server.git.uri=file:///C:/Users/admin/git/git-localconfig-repo
spring.cloud.config.server.git.uri=https://github.com/Nisarg04/microservices-config-repo.git
management.security.enabled=false

当我指向git-localconfig-repo时,它可以完美运行.但是,当我将其指向存储库时,就会出现错误,如Cannot clone or checkout repository: https://github.com/Nisarg04/microservices-config-repo.git

When I point to git-localconfig-repo, it works perfect. But, when I make it to point my repo, it gives be error as Cannot clone or checkout repository: https://github.com/Nisarg04/microservices-config-repo.git

我该如何解决?

也尝试了
spring.cloud.config.server.git.username=nisarg04 spring.cloud.config.server.git.password=mypassword 但即使有这种帮助

EDIT : Also tried
spring.cloud.config.server.git.username=nisarg04 spring.cloud.config.server.git.password=mypassword but even this dint help

根据要求,我在下面添加了服务器类:

As requested I have added server class below:

@SpringBootApplication 
@EnableConfigServer
public class SpringCloudConfigServerApplication {
public static void main(String[] args) {
    SpringApplication.run(SpringCloudConfigServerApplication.class, args);
  }
}

推荐答案

我能够重现您的问题并找到解决方案.

I was able to reproduce your issue and find the solution.

FIX: 访问Git存储库时,通过在application.properties中添加 skip-ssl-validation=true 来跳过SSL验证:

FIX: Skip SSL validation by adding skip-ssl-validation=true in application.properties when accessing the Git repo:

spring.application.name=spring-cloud-config-server
server.port=8888
#spring.cloud.config.server.git.uri=file:///C:/Users/admin/git/git-localconfig-repo
spring.cloud.config.server.git.uri=https://github.com/Nisarg04/microservices-config-repo.git
spring.cloud.config.server.git.skip-ssl-validation=true
management.security.enabled=false

这篇关于如何将github存储库配置为Spring Cloud Server的配置存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆