Jonathan
Jonathan

Reputation: 691

Mirror Git Repository Periodically

Let's say that I have two Git repositories that have been created. One repository is accessible to my software team internally but external customer access is not permitted (call this the repository-to-mirror). The other repository is accessible by my software team and my customer's software team (call this the mirrored-repository).

I'd like to push the changes three times per day (early morning, after lunch, end of day) to the mirrored-repository. What is the most recommend method to synchronize the changes in the repository-to-mirror with the mirrored-repository using Git?

I have done some research and found help pages on mirroring a repository in another location. It looks like the only option really is to define a different remote destination (the mirror) and push references to that repository. Is this correct?

Upvotes: 0

Views: 808

Answers (1)

LightBender
LightBender

Reputation: 4253

You are correct, this is usually the best way to accomplish mirroring.

If both teams will be committing to their respective repos, you might be better off with a more traditional fork rather than a mirror. Bi-directional mirroring is theoretically possible, but fraught with problems.

I wouldn't presume to tell you not to use this workflow, I'm very much a pragmatist when it comes to finding a workflow that meets your needs. But I will caution that 'git mirroring' is one of those phrases that throws up little red flags in my brain because it is often a solution to a symptom of a much bigger problem. So I will recommend taking a moment to step back and articulate your reasons.

For example, you might ask yourself: If everyone has access to the external repository, why not have everyone just use the external source? If the automatic answer is "security," bear in mind that you're already planning to push your codebase and history out to the remote. Of course, sometimes the answer is "the [laywers|owners|lizards] say so" at which point you just have to deal with it.

Upvotes: 1

Related Questions