注意,即使是public的repo,也需要在配置文件里注明用户名和密码,或者私钥才行,不然结果就是404,后台看日志就是超时!
部分config的配置如下:
spring:
application:
name: config-server
cloud:
config:
server:
git:
uri: https://github.com/xxxx/config-repo.git
#强制拉去资源文件
force-pull: true
#默认分支
default-label: main
username: xxxx
password: xxxx
请求路径:
http://localhost:port/label/文件名字.yml
经测试,只有这种格式可以拉去到配置,格式可以不同,如.yml或.json等,会自动做转换