springcloud 整合config server 报错org.springframework.cloud.config.server.environment.NoSuchRepositoryException: Cannot clone or checkout repository
今天学到springcloud ,其中整合config
application.yml 配置如下:
server:
port: 3344
spring:
application:
name: cloud-config-center #注册进eureka服务
cloud:
config:
server:
git:
uri: https://github.com/xxx/SpringCloud.git #GitHub仓库名
# 搜索目录
search-paths:
- SpringCloud
skip-ssl-validation: true
# 读取分支
label: master
eureka:
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://localhost:7001/eureka/
# 集群版
# defaultZone: http://localhost:7001/eureka/,http://localhost:7002/eureka/
然后访问 http://localhost:3344/xxx/SpringCloud/master/config-test.yml 是出现错误
最后各种百度查资料,结果是权限问题,需要我们在application.yml 文件中添加 账户和密码
server:
port: 3344
spring:
application:
name: cloud-config-center #注册进eureka服务
cloud:
config:
server:
git:
uri: https://github.com/hj950818/SpringCloud.git #GitHub仓库名
# 搜索目录
search-paths:
- SpringCloud
skip-ssl-validation: true
username: xxxxx
password: xxxxx
# 读取分支
label: master
eureka:
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://localhost:7001/eureka/
# 集群版
# defaultZone: http://localhost:7001/eureka/,http://localhost:7002/eureka/
然后再次访问结果如下:http://localhost:3344/hj950818/SpringCloud/master/config-test.yml