gitlab-sync

38

GitHub Action that mirrors your repos to GitLab automatically

GitHub ActionsGitLabCI/CDDevOpsYAML

What it does

gitlab-sync is a GitHub Action that automatically mirrors any GitHub repository to GitLab on every push. Drop it into a workflow file, configure three secrets, and your repos stay in sync — no server, no cron job, no cost.

It's used across 162 repositories by developers who want GitLab as a backup, need to satisfy compliance requirements, or run CI/CD pipelines on both platforms.

Setup

Three secrets and a workflow file:

name: Sync to GitLab
on: push
jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: keninkujovic/[email protected]
        with:
          gitlab_url: ${{ secrets.GITLAB_URL }}
          username: ${{ secrets.USERNAME }}
          gitlab_pat: ${{ secrets.GITLAB_PAT }}

fetch-depth: 0 matters — without it, GitHub's shallow clone only mirrors the latest commit instead of the full history.

Why it exists

Most mirroring solutions require a server, a cron job, or a paid GitLab tier. gitlab-sync runs entirely inside GitHub Actions — fires on push, does the sync, exits. The force_push option handles cases where histories have diverged and you need to overwrite the destination.