SpringCloud-config報錯Cannot clone or checkout repository
1.創建倉庫
注意:將倉庫設置爲Public
2.生成到本地
進入自己目錄 生成git
git init // 生成.git文件夾
ssh-keygen -s -rsa // 生成密匙
2.打開生成好的SpringC1.pub文件,複製內容
3.綁定自己生成的密匙,添加到SSH中
3.SpringCloud-yml配置
server:
port: 3344
spring:
application:
name: cloud-config-center # 服務名稱
cloud:
config:
server:
git:
# uri: [email protected]:NoMessages/sprincloud-config.git # 填寫你自己的github路徑
uri: https://github.com/NoMessages/sprincloud-config.git # 填寫你自己的github路徑
# 搜索目錄
search-paths:
- springcloud-config
# 閱讀分支
label: master
# 註冊到eureka
eureka:
client:
service-url:
defaultZone: http://localhost:7001/eureka
2. 在Host中配置config-3344 做路徑映射 目錄路徑:C:\Windows\System32\drivers\etc , 添加:127.0.0.1 config-3344.com
4.啓動Cloud服務
請求方式 | 請求master分支 | 請求其他分支 |
---|---|---|
{label}/{application}-{profile}.yml(最推薦使用這種方式) | http://config-3344.com:3344/master/config-dev.yml | http://config-3344.com:3344/dev/config-dev.yml |
{application}-{profile}.yml | http://config-3344.com:3344/config-dev.yml(配置文件決定) | http://config-3344.com:3344/config-xxxx.yml(不存在的配置) |
{application}-{profile}[/{label}] | http://config-3344.com:3344/config/dev/master | http://config-3344.com:3344/config/dev/dev |