首先,在配置中檢查要讀取的分支是否正確,從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