Series: HomeLab
Tags: technical-tutorials, git, github, gitlab, devops, automation
Lots of shops run GitHub for source control and GitLab for CI/CD and project management. The problem is that GitLab’s repository mirroring is a premium feature at $348 a year, which is hard to justify for small teams or one-off projects. Here’s how to mirror GitHub repositories to GitLab without paying for it.
Beyond redundancy, a mirror on GitLab means you can use its CI/CD pipelines and issue tracking while still managing your code on GitHub.
GitLab’s repository mirroring is an excellent feature but is gated behind their premium tier, costing $29/month when billed annually. For large corporations, this fee is a drop in the bucket. However, for smaller teams or projects with tight budgets, saving on these costs while maintaining a high level of operational efficiency can be crucial.
The solution uses open-source tools and scripts to set up your own mirroring. It costs nothing and you can customize it however you like.
Before you begin, you’ll need:
repo scope and from GitLab with api scope.The process involves several steps:
.env example file.gl_repo_create.py script to create new GitLab projects.setup_mirror.sh for each repository you want to mirror.update_mirror.sh.To ensure your repositories are always synchronized, you can set up a cron job that runs at intervals you define.
This method is particularly advantageous for:
That’s it. A cron job and two scripts get you GitHub-to-GitLab mirroring for free, which leaves the $348 in your budget for something that actually needs paying for.
Special thanks to “The Queen of RBAC” for insights that significantly contributed to the development of these scripts.
Remember, while this approach saves costs, supporting platforms like GitLab through subscriptions can also be beneficial if their features add value to your projects and you have the budget for it. This balance between cost-saving and support for development platforms is crucial for sustaining a healthy ecosystem in software development.