SpringCloud配置中心Config 配置报错 Cannot clone or checkout repository

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

访问请求地址 http://config-3344.com:3344/master/config-dev.yml

猜你喜欢

转载自blog.csdn.net/weixin_43409994/article/details/106959717
今日推荐