首先,在配置中检查要读取的分支是否正确,从2020年几月份开始,github上的master分支变为了mian分支。因此yml中读取分支的配置应该是:label: main
其次,如果yml使用的是uri: [email protected]:springcloud-config.git这种ssh方式连接的话,需要进行其他的配置,因此我放弃了这种方式进行配置,而采用http/https方式进行配置。值得注意的是,采用http和https方式,如果没配置免密的话,需要在配置文件中加入密码及用户名。
详细案例如下
server:
port: 3344
spring:
application:
name: cloud-config-center #注册进Eureka服务器的微服务名
cloud:
config:
server:
git:
####仓库地址
uri: https://github.com/wang692/springcloud-config.git #GitHub上面的git仓库名字
####搜索目录,即仓库名
search-paths:
- springcloud-config
####读取分支,main即代表springcloud-config仓库的master分支
label: main