Keep two repos in sync without forking

694 views Asked by At

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
1

There are 1 answers

0
matt On

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.