SpringCloud学习---配置中心报错Cannot pull from remote XX.git the working tree is not clean

在SpringCloud配置中心拉取配置文件的时候,如果本地缓存文件被更改,则会遇到以下问题。

 Cannot pull from remote https://******.git, the working tree is not clean.

而我遇到这个问题的原因就是我将本地的缓存删除了。
查询了一下SpringCloud的官网,是有这个问题的解决方案的。
https://github.com/spring-cloud/spring-cloud-config/blob/master/docs/src/main/asciidoc/spring-cloud-config.adoc#force-pull-in-git-repositories

SpringCloud配置服务器会复制远程git存储库,如果本地副本变得不干净,那么SpringCloud配置服务器就不能更新远程存储库中的本地副本,解决这个问题,可以配置一个强制拉取的属性,如果本地副本是脏的,它将使SpirngCloud配置服务器从远程存储库中强制pull.

spring.cloud.config.server.git.force-pull=true

你可能感兴趣的:(SpringCloud)