Can Has: Better Mirroring to the Git Hubs?

April 9th, 2009 by ymendel 2 comments »

Some time ago, Rick worked out this slightly wacky scheme to handle our git repos, with backups and mirrors and suchlike. After much prodding from me, he posted about it, accompanied by just one quite-wacky picture and a lot of code-like content.

He’s no Giles Bowkett.

To help people out, we keep pushing this kind of mirroring scheme upon them when they even come close to asking about handling git repos, and we do it for their own good. We went through some headaches, we suffered from reliability and stability issues, and we wrote down some simple steps to follow and get your mirroring up and running. The problem was that each new repository created required some manual work to get the mirroring set up.

But no more! Mr. Damien Lebrun (dinoboff on github) left a comment on that old post telling us he had come to save the day with his Python skills and desire to scratch an itch.

Now all you have to do put something like this in your gitosis.conf:

[repo freshtrack]
mirrors =

If you do that, it Just Works™. Well, it Just Works™ if you let Damien’s new gitosis create the repo using its fancy template with its special post-receive hook. If the repository already exists on your gitosis host, you’ll have to handle any hook placement yourself. Damien said as much in his comment, and it’s really obvious anyway, but that didn’t stop me from spending ten minutes trying to figure out why the mirroring wasn’t working.

And it gets even better! Prompted by a question from me (or quite possibly something he was going to do anyway), he made it simple to set the mirror on multiple repositories at once. Check this out from my own gitosis.conf:

[mirror ymendel-github]
repos = dugdale flac2mp3 fsevents graphtunes markov music_conversion_observer one_inch_punch pj punch_widget truthy pj_talk truthy_talk
uri =

It’s really that simple. No more logging in to the gitosis host and futzing with repositories. (At least not once you futz with the ones that are already there. Deal with it.)

To Damien Lebrun, a git-mirroring hero. Check out his fork of gitosis for more information, and especially check out the example configuration.

Update 2009-04-12 Damien just sent word that the repetition in the group and mirror sections can be reduced with the brand-new repo aliases. Check out the example mirror config (and pay attention to the lines involving “public” and “@public”.