github-gitlab-mirror

Audits and synchronizes GitHub main branch to an internal GitLab mirror.

2.3k|242|Updated Feb 28, 2026
One-click install
npx skills add https://github.com/AgentsMesh/AgentsMesh --skill github-gitlab-mirror
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: github-gitlab-mirror
Source: https://github.com/AgentsMesh/AgentsMesh/tree/main/agents/skills/github-gitlab-mirror
Command: npx skills add https://github.com/AgentsMesh/AgentsMesh --skill github-gitlab-mirror

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Teams that treat GitHub as the source of truth but build and deploy from an internal GitLab mirror need a safe way to detect drift, fast-forward the mirror, and handle divergence without ever leaking GitLab-only commits back into GitHub.

Core Features & Use Cases

  • Consistency Auditing: Fetches both remotes, compares SHAs, and classifies the relationship as equal, fast-forwardable, GitLab-ahead, or diverged.
  • Safe Synchronization: Pushes verified fast-forwards to GitLab and requires explicit authorization plus an exact --force-with-lease expectation before rewriting a divergent mirror branch.
  • Post-Sync Verification: Re-fetches both remotes and demands exact SHA equality before reporting success, including whether the GitLab build/deploy pipeline triggered.
  • Use Case: Before a release, check whether the internal GitLab mirror matches GitHub main, fast-forward it if behind, and confirm the deployment pipeline ran on the mirrored commit.

Quick Start

Check whether my GitHub main and GitLab mirror are in sync, and update the GitLab mirror if it is safely behind.

Frequently Asked Questions about github-gitlab-mirror

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sync a GitHub repository to a GitLab mirror?

Fetch main from both remotes, compare their SHAs, and if GitLab is an ancestor of GitHub, push the GitHub ref to GitLab with git push <gitlab-remote> <github-remote>/main:refs/heads/main. Verify equality with a fresh fetch afterward.

How do I check if GitHub and GitLab branches are in sync?

Fetch main from both remotes and compare git rev-parse output for each ref. Then run git log in both directions to list commits unique to either side and classify the relationship as equal, fast-forward, GitLab-ahead, or diverged.

What happens if the GitLab mirror has diverged from GitHub?

The sync stops and displays the GitLab-only commits. Rewriting the mirror requires explicit user authorization and a git push --force-with-lease using the previously fetched GitLab SHA as the lease expectation.

Can GitLab-only commits be pushed back into GitHub?

No. The workflow explicitly forbids merging, cherry-picking, or pushing GitLab-only commits into GitHub, since GitHub main is the single source of truth and GitLab only mirrors it for builds and deploys.

Why does force push to the GitLab mirror fail?

The --force-with-lease check fails when the remote GitLab SHA no longer matches the expected value, meaning someone else updated the branch. Fetch again and reassess instead of weakening the lease protection.