0

I have a repo inside a GitHub organization.

It has its code which depends on some credentials. It will basically look for a file called as environment.properties, which will contain a key-value pair like env=pps, and will then go on to read a file called as pps-credentials.properties.

We want to have another repo in the same organization but maintain the same code. This will be deployed to another cloud environment and read the environment file and find a pair like env=jkd and then read the jkd-credentials.properties.

Both these codes will be deployed to different cloud environments.

Our requirement is that:

  1. This new repo should be in the same organization as the old repo
  2. The code for the two repos should be exactly same
  3. Since its in same organization, it cant be forked, but we still need to be able to sync the changes made on the old repo to the new one. There will not be any changes to the code, this I can guarantee
Sparker0i
  • 1,787
  • 4
  • 35
  • 60
  • 2
    Is it possible to keep the code and configuration separate? The complexity of two codebases that are the same except for a few lines of configuration is the inspiration for this guideline, I think: https://12factor.net/config – Jake Worth Apr 29 '21 at 20:31
  • Whichever environment it is deployed to, it will always read from environment.properties, (which will be present in any env we deploy to). Just that the value in that file will be different based on the environment – Sparker0i Apr 30 '21 at 05:09
  • The code remains the same.. – Sparker0i Apr 30 '21 at 05:09
  • 1
    Then is there a need to have two repos? Why not use the same for both? – GoodDeeds Apr 30 '21 at 05:10
  • Because these two repos will deploy to two different environments. In each environment it will read from a different kafka broker and topic, hence the different credentials.. – Sparker0i Apr 30 '21 at 05:14
  • And moreover these two repos represent two different teams which need the same codebase.. And the new repo requires that it remains in sync with the parent repo – Sparker0i Apr 30 '21 at 05:15

1 Answers1

1

If someone, such as you, has a local copy of this repo, you can give your copy two remotes, representing the two GitHub repos, and just keep them in sync manually by fetching from one and pushing to the other.

This actually is no different from how you keep a fork in sync with its original (upstream). You don’t need a GitHub fork to do that.

I actually do this as a way of having a backup copy of my company repo. If the company server goes down temporarily (it has happened sometimes) I still have my code and a place to push to.

matt
  • 515,959
  • 87
  • 875
  • 1,141