The [gitlab-mirrors](https://github.com/sag47/gitlab-mirrors) project is designed to fill in a feature which is currently [missing from GitLab](http://feedback.gitlab.com/forums/176466-general/suggestions/4286666-mirror-git-svn-into-repo-): the ability to mirror remote repositories. gitlab-mirrors creates read only copies of remote repositories in gitlab. It provides a CLI management interface for managing the mirrored repositories (e.g. add, delete, update) so that an admin may regularly update all mirrors using `crontab`. It operates by interacting with the [GitLab API][1] using [python-gitlab][2].
The [gitlab-mirrors](https://github.com/sag47/gitlab-mirrors) project is designed to fill in a feature which is currently [missing from GitLab](http://feedback.gitlab.com/forums/176466-general/suggestions/4286666-mirror-git-svn-into-repo-): the ability to mirror remote repositories. gitlab-mirrors creates read only copies of remote repositories in gitlab. It provides a CLI management interface for managing the mirrored repositories (e.g. add, delete, update) so that an admin may regularly update all mirrors using `crontab`. It operates by interacting with the [GitLab API](http://api.gitlab.org/) using [python-gitlab3](https://github.com/alexvh/python-gitlab3).
## Features
* Mirror different types of repositories: Bazaar, git, subversion.
* When adding a mirror if the project doesn't exist in GitLab it will be auto-created.
* GitLab mirror adding.
* When adding a mirror if the project doesn't exist in GitLab it will be auto-created.
* Set project creation defaults (e.g. issues enabled, wiki enabled, etc.)
@@ -22,7 +22,7 @@ Create `~/.ssh/config` for the `gitmirror` user. Add your GitLab server host an
Create a gitmirror user in gitlab. Set up the SSH keys with the gitmirror user in GitLab. Obtain the Private token from the user.
Create "Mirrors" group in gitlab and designate gitmirror user as the Owner of the group.
Create "Mirrors" group in gitlab and designate gitmirror user as the Owner of the group. Realistically the group does not have to be called `Mirrors`. It could be anything and in fact multiple mirror groups can be mirrored within the same repository folder.
Clone the gitlab-mirrors repository and set values in config.sh.
...
...
@@ -40,6 +40,35 @@ Once you have set up your `config.sh` let's add the `git-mirrors.sh` script to `
Here's an example of a file tree where I have multiple groups specified with a different gitlab-mirrors project governing each.
```
/home/gitmirror/
├── ellucian
├── mirror-management
│ ├── GitLab
│ │ └── gitlab-mirrors
│ ├── Mirrors
│ │ ├── authors_files
│ │ ├── gitlab-mirrors
│ └── Subscribers
│ └── gitlab-mirrors
└── repositories
├── GitLab
│ └── gitlab-mirrors
├── Mirrors
│ ├── git
│ ├── gitlabhq
│ ├── gitlab-shell
│ ├── nsca-ng
│ ├── python-gitlab
│ ├── ruby
│ └── systems-svn
└── Subscribers
└── GitLab Enterprise Edition
```
Where I have all of my gitlab-mirrors installation located in `/home/gitmirror/mirror-management` and the config.sh for each is similar except for the `gitlab_namespace` option for each [`config.sh`](../config.sh.SAMPLE).
## Using your own user
Your steps will be similar to using a dedicated `gitmirror` user. Set up your SSH keys; copy `config.sh` and configure it; use your own system cron job to synchronize mirrors on a schedule. There are a few caveats to using your own user instead of a dedicated administrator.