Nisarg Patil
Nisarg Patil

Reputation: 1639

How to configure a github repository as a config repo for spring cloud server?

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

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

How do I resolve this?

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);
  }
}

Upvotes: 3

Views: 3857

Answers (1)

Victor
Victor

Reputation: 474

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

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

Upvotes: 5

Related Questions