Spring cloud config server Could not fetch remote for master remote: 解决

公司最近迁移了git仓库  修改了  spring cloud repo git的地址 

但是Sping Cloud Config server  服务器的git repo地址还是没有改变还是以前的git地址,错误如下

 c.s.e.MultipleJGitEnvironmentRepository : Cannot pull from remote the working tree is not clean.
后来在Spring Cloud官网找到了答案

https://github.com/spring-cloud/spring-cloud-config/blob/master/docs/src/main/asciidoc/spring-cloud-config.adoc#force-pull-in-git-repositories

  Spring Cloud配置服务器会复制远程git存储库,如果本地副本变得不干净(例如,通过OS进程更改文件夹内容),那么Spring Cloud配置服务器就不能更新远程存储库中的本地副本。为了解决这个问题,有一个强制拉属性,如果本地副本是脏的,它将使Spring Cloud配置服务器从远程存储库中强制pull.

spring:
  cloud:
    config:
      server:
        git:
          uri: https://github.com/spring-cloud-samples/config-repo
          force-pull: true
添加 force-pull 属性 默认是true

同时在重新启动Config server的时候需要删除临时 git config-repo- 文件 以下为官网提示


With VCS based backends (git, svn) files are checked out or cloned to the local filesystem. By default they are put in the system temporary directory with a prefix of config-repo-. On linux, for example it could be /tmp/config-repo-<randomid>. Some operating systems routinely clean out temporary directories. This can lead to unexpected behaviour such as missing properties. To avoid this problem, change the directory Config Server uses, by setting spring.cloud.config.server.git.basedir or spring.cloud.config.server.svn.basedir to a directory that does not reside in the system temp structure.

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值