Skip to content
Snippets Groups Projects
Commit bc768f71 authored by Sam Gleske's avatar Sam Gleske
Browse files

updated docs

parent 0b162c99
No related branches found
No related tags found
No related merge requests found
# gitlab-mirrors
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.)
* Delete mirrors both local and remote.
* Update a single mirror.
* Update all known mirrors.
* List all known mirrors.
......
......@@ -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 `
@hourly /home/gitmirror/gitlab-mirrors/git-mirrors.sh
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.
......
......@@ -12,6 +12,8 @@ Currently gitlab-mirrors supports the following repository types.
## Create a mirror
See also `./add_mirror.sh --help`.
### Bazaar
The Bazaar support comes from [`git-remote-bzr`](https://github.com/felipec/git/wiki/git-remote-bzr).
......@@ -46,12 +48,16 @@ Notice in [`config.sh`](../config.sh.SAMPLE) there's an option `git_svn_addition
## List all known mirrors
See also `./ls-mirrors.sh --help`.
su - gitmirror
cd gitlab-mirrors
./ls-mirrors.sh
## Delete a mirror
See also `./delete_mirror.sh --help`.
su - gitmirror
cd gitlab-mirrors
./delete_mirror.sh --delete someproject
......
......@@ -3,7 +3,7 @@
### Required software
* [GitLab 6.x][1]
* [pyapi-gitlab @ 4d778d7][2]
* [pyapi-gitlab3 @ v0.5.2][2]
* [GNU coreutils][3]
* [git 1.6.5][4] or later (git 1.6.5 introduced transport helpers)
......@@ -20,9 +20,9 @@ If you plan on mirroring BZR repositories then you'll need the following adition
#### python-gitlab
yum install python-setuptools
git clone https://github.com/Itxaka/python-gitlab.git
cd python-gitlab
git checkout 4d778d780161869550d8e514cdc50df2398f844e
git clone https://github.com/alexvh/python-gitlab3.git
cd python-gitlab3
git checkout v0.5.2
python setup.py install
......@@ -55,7 +55,7 @@ Your git should now be located in `/usr/local/bin/git`. You should edit `/etc/p
Next up is [Installation and Setup](installation.md).
[1]: https://github.com/gitlabhq/gitlabhq/tree/6-2-stable
[2]: https://github.com/Itxaka/pyapi-gitlab
[2]: https://github.com/alexvh/python-gitlab3
[3]: http://www.gnu.org/software/coreutils/
[4]: http://git-scm.com/
[5]: http://code.google.com/p/git-core/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment