Search code examples
gitdrupalofflinemirroring

How to maintain a local mirror of Drupal.org projects?


Now that Drupal.org has switched to using Git, is there an easy way to maintain an up-to-date mirror of a selected subset (or even all) of the core and contrib projects locally? Or would that be discouraged because of the strain it would put on the drupal.org infrastructure?

I realize I can clone individual projects, but I'd like a mirror that automatically pulls updates periodically. It would be nice to have projects available in the event of an outage, plus it would make it easier to develop when offline.


Solution

  • To answer your technical question about mirroring the projects, here's what I would do:

    • Get a list of all of the projects (since git.drupal.org doesn't have a project list)
    • Create a directory to hold all of the mirrors (ie, ~/projects/drupal-mirror/)
    • For each project, run git clone git://git.drupal.org/project/<project>.git <project>
    • Setup a cronjob to run git pull for each one of those projects, every week or so.

    For your local development, you can clone your local mirror to another directory.

    In regards to whether or not it's the polite way to do it, I suppose only the Drupal community can answer that. What I can say, though, is that the git protocol is fairly efficient and won't result in much overhead to maintain your mirrors. If you want to stagger your pulls, you could run the git pull for each project in a staggered fashion, so you're not hitting all of them one after the other every week.