3

I'm trying to setting up spring cloud config server

-Created git repository folder on my local F:\git-local-repository\repository

-linked it using class path link source -Added property file for my service

-After committing my changes on location F:\git-local-repository\repository

-hitting url : http://localhost:8888/limits/default

result in error : org.springframework.cloud.config.server.environment.NoSuchLabelException: No such label: master

Caused by: org.eclipse.jgit.api.errors.RefNotFoundException: Ref master cannot be resolved

Following is my main class of spring boot application

@EnableConfigServer


@SpringBootApplication
public class SpringCloudConfigServerApplication {

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


}

}

application.properties

spring.application.name=spring-cloud-config-server

server.port=8888

spring.cloud.config.server.git.uri=file:////F:/git-local- 
repository/repository

expected result: will be showing application property details and other url's

kiran rathod
  • 163
  • 3
  • 5
  • 17

6 Answers6

3

If you are using a local directory for configuration.

Instead of

spring.cloud.config.server.git.uri=file:////F:/git-local-repository/repository

Use

spring.cloud.config.server.native.search-locations=file:////F:/git-local-repository/repository
Himadri Mandal
  • 325
  • 2
  • 11
2

The issue is with extra forward slash. Please change to this :

spring.cloud.config.server.git.uri=file:///F:/git-local- 
repository/repository
GnanaJeyam
  • 2,780
  • 16
  • 27
1

I had the same problem and it was because git change the default name of the branch, now it is main, while spring is searching for master.

Adding 'spring.cloud.config.server.git.default-label=main' fixed my problem.

Bozhidar Marinov
  • 116
  • 2
  • 15
0

If you are issuing NoSuchLabelException you can try to add spring.cloud.config.server.git.default-label=branch-name property to lead your spring cloud config server directly to this branch.

B.Pukhalskyi
  • 51
  • 11
-1

Adding bootstrap.yml file with following configuration worked for me.

spring:
   application:
        name: spring-cloud-config-server
profiles:
active: composite
cloud:
 config:
  server:
    composite:
      - type: native
        search-locations: file:////F:/git-local-repository/repository
          bootstrap: true
server:
  port: 8888
endpoints:
  restart:
     enabled: true
kiran rathod
  • 163
  • 3
  • 5
  • 17
-1

Did so many things to resolve this however it was adding

spring.cloud.config.server.git.default-label=main to application.properties worked