Skip to content
Simple set of Python scripts to mirror a GitLab group to a GitHub organization
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.
admin lab2hub: Add option to --delete all mirror repositories Mar 12, 2020
sync lab2hub: Add option to --delete all mirror repositories Mar 12, 2020
.gitignore sync: Add option to fetch without pushing/optimizing Mar 11, 2020
COPYING Initial Commit Mar 10, 2020 Add README Mar 12, 2020 lab2hub: Add option to --delete all mirror repositories Mar 12, 2020
requirements.txt Initial Commit Mar 10, 2020 sync: Print when starting sync and how long it took Mar 12, 2020


lab2hub uses the GitLab API to find all repositories on a GitLab group, and mirrors them automatically to a GitHub organization. It synchronizes:

  • All branches/tags/notes
  • Repository description and tags/topics
  • Protected branches

There are two separate parts:

  • admin: Creates new repositories and updates repository settings
  • sync: Clones repositories and pushes them to the mirror

In most cases it should be enough to have a cron job for sync, and run the admin part manually when necessary.


lab2hub requires Python 3.7. It is possible to use it with Python 3.6 when installing the backported dataclasses package from pip.

$ pip install -r requirements.txt


No setup is necessary on the GitLab side. It uses the GitLab API read-only without authentication.

On GitHub you need to setup two GitHub Apps: admin and sync. Those are used for authentication with GitHub. The following permissions are needed:

  • admin: Administration: Read & write
  • sync: Contents: Read & write

Install both GitHub Apps on the organization where the mirror repositories should be created. Create and download private keys for the GitHub Apps.


  • admin: Use ./ <gitlab_group> <github_organization> --app-id <app_id> --key path/to/admin.pem
  • sync: Use ./ <installation_id> --app-id <app_id> --key path/to/sync.pem

Add a cron job (e.g. one hour) to synchronize changes from GitLab to GitHub.

You can’t perform that action at this time.