0

We are implementing an environment in Visual Studio Team Services (VSTS). We have a Git Repo tied to VSTS

The problem is how to keep the Config files separate so they retain their unique values in their local environments? But without uploading Configs VSTS fails to Build within it's environment.

We don't want the same config settings that are in VSTS to always Sync to Local Environments nor do we want to Push our local configs to the Master. Obviously, we can Exclude on Push but the question is how to configure VSTS in a manner that allows it to Build successfully without requiring config files to be uploaded to the Repo?

Reviewing this post, I'm not sure whether or not Repo based configs are required: How to handle multiple configurations in VSTS Release management? And yes we will eventually have multiple configs to allow Staging and Production releases.

Flow Chart

Community
  • 1
  • 1
Burndog
  • 711
  • 2
  • 8
  • 21

1 Answers1

1

The direct answer is No. Usually git only track source code for projects, and VSTS usually can build successful without config files. I’m not sure what’s your project is, so we can deal with the situation for that you need to push the config file to VSTS but also do not effect local settings when git pull (assume the name of the config file is project.config):

Option 1:

If it’s ok for you to rename project.config when you build in VSTS, you can use project.config for your local environments and projectRemote.config for the remote repo: gitnore project.config in .gitignore, and create projectRemote.config file to push to remote.

Option 2:

Keep local project.config version when pull changes from remote. You can keep local versions by:

touch .gitattributes
echo  'project.config merge=ours' >> .gitattributes
git config --global merge.ours.driver true

Note: the merge strategies seems only works when the pull is not fast forward.

Marina Liu
  • 36,876
  • 5
  • 61
  • 74