githubmirroring

Creating an official github mirror


How do I create a github mirror for an external git repository, such that it appears as "real mirror", e.g., as in https://github.com/mirrors?

So far, I set up a mirror using:

cd /path/to/bare/repository
git remote add --mirror github git@github.com:user/repo.git

and configure the post receive hook to do a git push --quiet github. This way, however, github does not recognize the mirror.

Any ideas how to do it the github way, such that "Mirrorred from" appears underneath the repostiory name?


Solution

  • Based on communicating with GitHub's support team, I found that GitHub currently offers no direct mechanism for a user to mirror repositories in this fashion.

    However, one can ask GitHub to install this service for repositories which are part of an organization. GitHub then configures an existing repository as such a mirror and pulls from it in an interval that is a function of the number of overall mirrors they have.

    EDIT: as Stuart points out, GitHub no longer accepts requests for mirroring arbitrary repositories. The only remaining option is the solution I posted in my question, i.e., creating a post-receive hook to automatically push to your GitHub repository.