GitLab Mirror Maker
GitLab Mirror Maker is a small tool written in Python that automatically mirrors your public repositories from GitLab to GitHub.
Why?
- Maybe you like GitLab better but the current market favors developers with a strong GitHub presence?
- Maybe as a form of backup?
- Or maybe you have other reasons... :wink:
Installation
Install with pip or pipx:
pip install gitlab-mirror-maker
There's also a Docker image available:
docker run registry.gitlab.com/grdl/gitlab-mirror-maker
Usage
Run: gitlab-mirror-maker --github-token xxx --gitlab-token xxx
See Authentication below on how to get the authentication tokens.
Environment variables
Instead of using cli flags you can provide configuration via environment variables with the MIRRORMAKER_ prefix:
export MIRRORMAKER_GITHUB_TOKEN xxx
export MIRRORMAKER_GITLAB_TOKEN xxx
gitlab-mirror-maker
Dry run
Run with --dry-run flag to only print the summary and don't make any changes.
Full synopsis
Usage: gitlab-mirror-maker [OPTIONS]
Options:
--version Show the version and exit.
--github-token TEXT GitHub authentication token [required]
--gitlab-token TEXT GitLab authentication token [required]
--github-user TEXT GitHub username. If not provided, your GitLab
username will be used by default.
--dry-run / --no-dry-run If enabled, a summary will be printed and no
mirrors will be created.
--help Show this message and exit.
How it works?
GitLab Mirror Maker uses the remote mirrors API to create push mirrors of your GitLab repositories.
For each public repository in your GitLab account a new GitHub repository is created using the same name and description. It also adds a [mirror] suffix at the end of the description and sets the website URL the original GitLab repo. See the mirror of this repo as an example.
Once the mirror is created it automatically updates the target GitHub repository every time changes are pushed to the original GitLab repo.
What is mirrored?
Only public repositories are mirrored to avoid publishing something private.
Only the commits, branches and tags are mirrored. No other repository data such as issues, pull requests, comments, wikis etc. are mirrored.
Authentication
GitLab Mirror Maker needs authentication tokens for both GitLab and GitHub to be able to create mirrors.
How to get the GitLab token?
- Click on your GitLab user -> Settings -> Access Tokens
- Pick a name for your token and choose the
apiscope - Click
Create personal access tokenand save it somewhere secure - Do not share it! It grants full access to your account!
Here's more information about GitLab personal tokens.
How to get the GitHub token?
- Click on your GitHub user -> Settings -> Developer settings -> Personal access tokens -> Generate new token
- Pick a name for your token and choose the
public_reposcope - Click
Generate tokenand save it somewhere secure
Here's more information about GitHub personal tokens.
Automate with GitLab CI
Instead of running the tool manually you may want to schedule it to run periodically with GitLab CI to make sure that any new repositories are automatically mirrored.
Here's a .gitlab-ci.yml snippet you can use:
job:
image: python:3.8-alpine
script:
- pip install gitlab-mirror-maker
- gitlab-mirror-maker
only:
- schedules
Here's more info about creating scheduled pipelines with GitLab CI.
Metadata
Release files for gitlab-mirror-maker 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gitlab-mirror-maker-0.4.1.tar.gz | 6.0 kB | Without provenance | Details for gitlab-mirror-maker-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gitlab_mirror_maker-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for gitlab_mirror_maker-0.4.1-py3-none-any.whl |
Total release size: 12.8 kB
Release files / gitlab-mirror-maker-0.4.1.tar.gz
| Download URL | gitlab-mirror-maker-0.4.1.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68dc351ea51d01b9f08e3af6f5c7c1ae59ffab6ce867bbfa3e36a4f5ecef2ec0
|
|
BLAKE2b-256 checksum How to use checksums |
02622e9bb6032e47e89acbbd0aaeb7fcd6841c24050354287f35122a60b66ee5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.8.2 Linux/4.19.78-coreos
|
Release files / gitlab_mirror_maker-0.4.1-py3-none-any.whl
| Download URL | gitlab_mirror_maker-0.4.1-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6ffe903d34278a93f3ba524591708d8175c072a65c7afe662fb2ee15e51826f
|
|
BLAKE2b-256 checksum How to use checksums |
21b88a82b3b9eaf6ae6cf41c4852a2abb7b0d3582bcbd20368a9e75f1d36e95d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.8.2 Linux/4.19.78-coreos
|
Security for gitlab-mirror-maker 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.