Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I mirror a Bitbucket git repository to a local copy?

aeisenberg August 23, 2014

I have a few private Git repositories on Bitbucket that I need mirrored locally behind a firewall so we can use gerrit with them. The goal is that every time there is a push to the clone, the clone then pushes the new refs to bitbucket, and vice versa.

2 answers

1 accepted

1 vote
Answer accepted
TimP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 24, 2014

Hi Andrew,

To mirror changes from Gerrit to Bitbucket, you could use replication.

To mirror changes from Bitbucket to Gerrit, there are a couple of different options. The easiest way would be to have a cron job or other scheduled task that polls the Bitbucket repository for changes and then updates your Gerrit repo. If you want to set up a more efficient "push" method, you'd need to configure a POST Hook on your Bitbucket repository that triggers some kind of web service that pulls the changes down and pushes them in to your Gerrit repository.

I wrote a little bit more about one way you could handle two-way mirroring in this answers post: https://answers.atlassian.com/questions/325269/move-changes-from-disconnected-stash-repositories

cheers,

Tim

aeisenberg August 24, 2014

Thanks for the response. I'll try this out. Seems like the simplest would be a single cron job that runs the pulls and pushes in both directions. I might try that first to see if this works and doesn't create too much load on any servers before trying something more complex. I'll get back to you with my results.

aeisenberg September 9, 2014

I finally had a chance to try this out. I created a cron job that runs every few seconds and syncs the repos. Seems to work for now. Thanks for your suggestions.

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 24, 2014

I don't know anything about them, but you probably need to research "hooks".

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events