3

I'm working on a project that is hosted on Bitbucket. I would also like to have the same project on the office server connected to a local intranet so that when I commit on my system, I can push to both repositories (Bitbucket and my local server).

The whole setup should be users can collaborate on the local version if internet is unavailable and when it's available, they can update the online version.

Martin Geisler
  • 72,968
  • 25
  • 171
  • 229
aim
  • 65
  • 6

1 Answers1

5

You can just do this — it's built into the model of distributed version control. So

  • Make a clone of the Bitbucket repository and put it on your local server.
  • Configure hgweb on Apache or similar to publish the repositories from the local server.
  • Setup a cronjob (or other scheduled task) that periodically pulls from Bitbucket into the local server repository.

Your users can now pull from either repository. They should still merge and push manually to either repository, just like normal.

Martin Geisler
  • 72,968
  • 25
  • 171
  • 229
  • "You'll also want a cronjob" -- no you probably don't or at least you want to be very careful about conflict handling. –  Dec 20 '11 at 13:24
  • 2
    The cronjob will *pull*, not *merge*, so there cannot be any problem with conflicts. The (trivial) workflow I'm describing above is just a matter of duplicating the Bitbucket repo locally, nothing more. – Martin Geisler Dec 20 '11 at 13:26
  • 1
    @MartinGeisler sorry it took ages to upvote and accept the answer, I was carried away and excited and just moved on working :). It solved the problem. – aim Mar 09 '13 at 13:36
  • @aim: no worries :) Thanks for coming back to it! – Martin Geisler Mar 10 '13 at 15:22