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 n
公司最近迁移了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. |
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)