I have a problem about getting properties file from Git.
I've done some settings for defining git local repo shown below.
- Open Git Bash
- mkdir git-localconfig-repo
- cd git-localconfig-repo
- git init
- git add
- git commit -m "Message"
- git branch -> master
git-localconfig-repo is located under C:/Users/Username/
Here is the application.properties file of Spring Cloud Config shown below
spring.application.name=spring-cloud-config-server
server.port=8888
spring.cloud.config.server.git.uri=file:///C:/Users/Username/git-localconfig-repo (I use Windows)
Here is the another services' properties file shown below
spring.config.import=optional:configserver:http://localhost:8888
spring.application.name=limits-service
When I tried to send a request to http://localhost:8888/limit-service/default , I got this json result shown below.
{"name": "limit-service","profiles": ["default"],"label": null,"version": "5161fd2bf848e99e7447f4bd95f4dcf914f97066","state": null,"propertySources": []}
Here are errors appearing on the console in Spring Cloud Config shown below.
org.springframework.cloud.config.server.environment.NoSuchLabelException: No such label: main
Caused by: org.eclipse.jgit.api.errors.RefNotFoundException: Ref main cannot be resolved
I defined spring.cloud.config.server.git.default-label=master or spring.cloud.config.server.git.default-label=main in application.properties file of Spring Cloud Config but nothing changed.
I defined master and then restart Config server and then restart limit service
Here is the application.properties file of Spring Cloud Config shown below
spring.application.name=spring-cloud-config-server
server.port=8888
spring.cloud.config.server.git.default-label=master
spring.cloud.config.server.git.uri=file:///C:/Users/Noyan/git-localconfig-repo
Here is the console result shown below.
2022-09-07 14:16:31.110 WARN 2096 --- [nio-8888-exec-1] .c.s.e.MultipleJGitEnvironmentRepository : Could not merge remote for master remote: null
2022-09-07 14:16:31.134 INFO 2096 --- [nio-8888-exec-1] o.s.c.c.s.e.NativeEnvironmentRepository : Adding property source: Config resource 'file [C:\Users\Noyan\git-localconfig-repo\limits-service.properties]' via location 'file:/C:/Users/Noyan/git-localconfig-repo/'
When I tried to send a request to http://localhost:8888/limit-service/default , I got this json result shown below.
{
"name": "limit-service",
"profiles": [
"default"
],
"label": null,
"version": "5161fd2bf848e99e7447f4bd95f4dcf914f97066",
"state": null,
"propertySources": []
}
Here is the console result shown below.
2022-09-07 14:16:31.110 WARN 2096 --- [nio-8888-exec-1] .c.s.e.MultipleJGitEnvironmentRepository : Could not merge remote for master remote: null
2022-09-07 14:16:31.134 INFO 2096 --- [nio-8888-exec-1] o.s.c.c.s.e.NativeEnvironmentRepository : Adding property source: Config resource 'file [C:\Users\Noyan\git-localconfig-repo\limits-service.properties]' via location 'file:/C:/Users/Noyan/git-localconfig-repo/'
2022-09-07 14:18:18.698 WARN 2096 --- [nio-8888-exec-6] .c.s.e.MultipleJGitEnvironmentRepository : Could not merge remote for master remote: null
How can I fix it?