How to mirror a git repository

As I was working on libgnusocial I went into trouble because we have three different git repositories: Gitlab, Github & and I wanted to keep them all updated. To do this I just work with one (at Gitlab) and I treat the others as mirrors. First of all, to mirror a git repository we need to clone it using the “mirror” argument:

$ git clone --mirror

Then move into the cloned repository directory (which git ends in “.git” due to the mirror cloning process):

$ cd repository.git

And finally push into an empty repository or an outdated mirror of our repository:

$ git push --mirror

Leave a Reply