Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent Spring Config to reset my local git repository to origin/master

I am using Spring Config to share in a git server the configuration for some Spring Boot microservices.

It works great but when I am traveling I have to work offline sometimes.
I have configured Spring Config microservice local profile to get the config from my local git, (file:) and not to be HTTP git server, so I can change config and test without needing access to main git server.

The problem is that as I am not able to do a "git push" to push the change to main repository, Spring Confgig notes it and shows this message:

The local repository is dirty or ahead of origin. Resetting it to origin/master.

and resets it deleting my last local commit with last config changes.

How can I make Spring Config just to get the last committed configuration in my local git ignoring if it is pushed or not to the main server?

like image 658
icordoba Avatar asked Dec 09 '18 12:12

icordoba


1 Answers

I had a similar problem. (the difference is that I am not using Spring Config microservice, but runnging spring configuration server as a stand alone application)

But this should work for you as well: Instead of launching local configuration server with a local git repository (file:) I have launched it with native spring profile.

spring:
   profiles:
      active: native
   cloud:
        config:
            server:
                native:
                    searchLocations: file:///path/to/local/git/repository

So now content of local repository is served and no reset is done on access

like image 192
Deniso Avatar answered Sep 20 '22 01:09

Deniso