spring-cloud-config-server - 无法为主远程合并远程:null

tec*_*ter 5 git spring-cloud-config

我已经使用 spring 开发了配置服务器。

我的 Application.java 是

@EnableConfigServer
@SpringBootApplication

public class SpringConfigServerApplication {

public static void main(String[] args) {
    SpringApplication.run(SpringConfigServerApplication.class, args);
}}
Run Code Online (Sandbox Code Playgroud)

我的 bootstrap.properties 文件

#Server port
server.port = 8888

#Git repo location
spring.cloud.config.server.git.uri=file://Users/dineth/Documents/MyProjects/sample-git-sources/config-server-repo
Run Code Online (Sandbox Code Playgroud)

我的 config-server-client-development.properties 文件

msg = Hello world - this is from config server – Development environment.
Run Code Online (Sandbox Code Playgroud)

我已经触发了 git init、git add 和 git commit 命令来将我的文件添加到本地 git。

但是当我运行应用程序并转到http://localhost:8888/client-config/development

它没有显示我的财产价值。

// 20200406064430
// http://localhost:8888/client-config/development

{
"name": "client-config",
"profiles": [
"development"
],
"label": null,
"version": "4f989b109d1e6d77c8f44a664b275305ddddf014",
"state": null,
"propertySources": [

]
}
Run Code Online (Sandbox Code Playgroud)

和应用程序日志说:

WARN 2125 --- [nio-8888-exec-2] .c.s.e.MultipleJGitEnvironmentRepository : Could not merge remote for master remote: null
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?

我正在使用 macOS

dba*_*tor 7

在将 git repo 指向本地目录时,您需要使用本配置文件运行配置服务器,在您的情况下file://Users/dineth/Documents/MyProjects/sample-git-sources/config-server-repo

只需将以下行添加到配置服务器application.properties

spring.profiles.active=native
Run Code Online (Sandbox Code Playgroud)