Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

gitea-mirror

> DevOps
Open source

Gitea Mirror auto-syncs GitHub repos to your self-hosted Gitea/Forgejo, with a sleek Web UI and easy Docker deployment.

1.3K stars0 likes1 views
WebsiteGitHub

About

Gitea Mirror auto-syncs GitHub repos to your self-hosted Gitea/Forgejo, with a sleek Web UI and easy Docker deployment.

Gitea Mirror

Automatically mirror repositories from GitHub to your self-hosted Gitea/Forgejo instance.

Quick Start

bash
# Fastest way - using the simplified Docker setup
docker compose -f docker-compose.alt.yml up -d

# Access at http://localhost:4321

First user signup becomes admin. Configure GitHub and Gitea/Forgejo through the web interface!

Full documentation - quickstart, deployment, configuration, notifications, SSO and more. Offline copies live in docs/.

✨ Features

  • Mirror public, private, and starred GitHub repos to Gitea/Forgejo
  • Multiple sources (GitLab and Gitea/Forgejo beta) - Connect several sources at once: GitHub and GitHub Enterprise, GitLab, Gitea/Forgejo, and each repository keeps its source. gitlab.com, Codeberg and self hosted instances mirror code, tags, wiki and LFS (issues, pull requests and releases need a GitHub source). GitHub to Gitea is the supported default; every other source or destination is beta. See docs/SOURCE_PROVIDERS.md
  • ️ GitHub Enterprise support - Works with GHES and GHEC with data residency via GH_API_URL
  • Forgejo, GitHub and GitLab destinations (beta) - Forgejo works like Gitea. Pick GitHub or GitLab and the app keeps a bare clone of each repository and pushes its branches and tags there. Code only, and the target is overwritten on every sync. See docs/PUSH_TARGETS.md
  • Mirror entire organizations with flexible strategies, including public organizations from GitHub, GitLab or Gitea/Forgejo with no source account configured
  • Custom destination control for repos and organizations
  • Git LFS support - Mirror large files with Git LFS
  • Metadata mirroring - Issues, pull requests (as issues), labels, milestones, releases, wiki
  • Repository ignore - Mark specific repos to skip
  • Secure authentication with Better Auth (email/password, SSO, OIDC, header auth)
  • Notifications - ntfy, Apprise, Gotify, or any webhook with signed payloads
  • Real-time dashboard with activity logs
  • ⏱️ Scheduled automatic mirroring with configurable intervals
  • Auto-discovery - Automatically import new GitHub repositories
  • Repository cleanup - Auto-remove repos deleted from GitHub
  • Proper mirror intervals - Respects configured sync intervals
  • ️ Force-push protection - Smart detection with backup-on-demand or block-and-approve modes
  • ️ Automatic database cleanup with configurable retention
  • Dockerized with multi-arch support (AMD64/ARM64)

Screenshots

Installation

Docker (Recommended)

We provide two Docker Compose options:

Option 1: Quick Start (docker-compose.alt.yml)

Perfect for trying out Gitea Mirror or simple deployments:

bash
# Clone repository
git clone https://github.com/RayLabsHQ/gitea-mirror.git
cd gitea-mirror

# Start with simplified setup
docker compose -f docker-compose.alt.yml up -d

# Access at http://localhost:4321

Features:

  • ✅ Pre-built image - no building required
  • ✅ Minimal configuration needed
  • ✅ Data stored in ./data directory
  • ✅ Configure everything through web UI
  • ✅ Automatic user/group ID mapping

Best for:

  • First-time users
  • Testing and evaluation
  • Simple deployments
  • When you prefer web-based configuration

Option 2: Full Setup (docker-compose.yml)

For production deployments with environment-based configuration:

bash
# Start with full configuration options
docker compose up -d

Features:

  • ✅ Build from source or use pre-built image
  • ✅ Complete environment variable configuration
  • ✅ Support for custom CA certificates
  • ✅ Advanced mirror settings (forks, wiki, issues)
  • ✅ Multi-registry support

Best for:

  • Production deployments
  • Automated/scripted setups
  • Advanced mirror configurations
  • When using self-signed certificates

Using Pre-built Image Directly

bash
docker pull ghcr.io/raylabshq/gitea-mirror:latest

Configuration Options

Quick Start Configuration (docker-compose.alt.yml)

Minimal .env file (optional - has sensible defaults):

bash
# Custom port (default: 4321)
PORT=4321

# User/Group IDs for file permissions (default: 1000)
PUID=1000
PGID=1000

# Session secret (auto-generated if not set)
BETTER_AUTH_SECRET=your-secret-key-change-this-in-production

All other settings are configured through the web interface after starting.

Full Setup Configuration (docker-compose.yml)

Supports extensive environment variables for automated deployment. See the full docker-compose.yml for all available options including GitHub tokens, Gitea URLs, mirror settings, and more.

For a complete list of all supported environment variables, see the Environment Variables Documentation.

LXC Container (Proxmox)

bash
# One-line install on Proxmox VE
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/gitea-mirror.sh)"

See the Proxmox VE Community Scripts for more details.

Nix/NixOS

Zero-configuration deployment with Nix:

bash
# Run immediately - no setup needed!
nix run --extra-experimental-features 'nix-command flakes' github:RayLabsHQ/gitea-mirror

# Or build and run locally
nix build --extra-experimental-features 'nix-command flakes'
./result/bin/gitea-mirror

# Or install to profile
nix profile install --extra-experimental-features 'nix-command flakes' github:RayLabsHQ/gitea-mirror
gitea-mirror

NixOS users - add the flake input, import the module, then enable the service:

nix
# flake.nix
inputs.gitea-mirror.url = "github:RayLabsHQ/gitea-mirror";

# configuration.nix (needs `inputs` passed through specialArgs)
{ inputs, ... }:
{
  imports = [ inputs.gitea-mirror.nixosModules.default ];

  services.gitea-mirror = {
    enable = true;
    betterAuthUrl = "https://mirror.example.com";
    openFirewall = true;
  };
}

Secrets auto-generate, database auto-initializes. See NIX.md for quick reference or docs/NIX_DEPLOYMENT.md for full documentation.

Manual Installation

bash
# Install Bun
curl -fsSL https://bun.sh/install | bash

# Setup and run
bun run setup
bun run dev

Usage

  1. First Time Setup

    • Navigate to http://localhost:4321
    • Create admin account (first user signup)
    • Configure the source and destination connections. GitHub to Gitea is the default. Forgejo works like Gitea, and GitHub or GitLab as destination uses push targets. Everything other than GitHub to Gitea is beta
  2. Mirror Strategies

    • Preserve Structure: Maintains GitHub organization structure
    • Single Organization: All repos go to one Gitea/Forgejo organization
    • Flat User: All repos under your Gitea/Forgejo user account
    • Mixed Mode: Personal repos in one org, organization repos preserve structure
  3. Customization

    • Click edit buttons on organization cards to set custom destinations
    • Override individual repository destinations in the table view
    • Starred repositories can go to a dedicated org or preserve source owner/org paths

Advanced Features

Git LFS (Large File Storage)

Mirror Git LFS objects along with your repositories:

  • Enable "Mirror LFS" option in Settings → Mirror Options
  • Requires Gitea/Forgejo server with LFS enabled (LFS_START_SERVER = true)
  • Requires Git v2.1.2+ on the server

Metadata Mirroring

Transfer complete repository metadata from GitHub to Gitea/Forgejo:

  • Issues - Mirror all issues with comments and labels
  • Pull Requests - Transfer PR discussions to Gitea/Forgejo
  • Labels - Preserve repository labels
  • Milestones - Keep project milestones
  • Wiki - Mirror wiki content
  • Releases - Transfer GitHub releases with assets

Releases have two limits. The release limit keeps only the newest N releases in Gitea/Forgejo. The release asset limit uploads assets only for the newest N of those, so a repository with years of releases can keep every release note and tag while only the recent binaries take up space. Leave the asset limit empty to upload assets for every mirrored release, or set it to 0 for release notes only. Both limits can be overridden per organization and per repository, and lowering the asset limit never deletes assets that were already uploaded.

Enable in Settings → Mirror Options → Mirror metadata

Repository Management

  • Ignore Status - Mark repositories to skip from mirroring
  • Automatic Cleanup - Configure retention period for activity logs
  • Scheduled Sync - Set custom intervals for automatic mirroring
  • Reconcile with Destination - Compare Gitea/Forgejo with the database from Configuration > Automation: adopt mirrors the database lost track of, record the new owner of mirrors you transferred in Gitea, or reset rows whose mirror is gone so the next sync recreates them. Nothing is deleted or archived by this step.
  • Move Mirrors from the App - Changing a repository's or an organization's destination offers to transfer the existing mirrors on Gitea/Forgejo as well, with their history, issues and mirror settings. When the token cannot create repositories under the new owner, Gitea asks its owners to accept and sync follows the mirror once they do.

Automatic Syncing & Synchronization

Gitea Mirror provides powerful automatic synchronization features:

Features (v3.4.0+)

  • Auto-discovery: Automatically discovers and imports new GitHub repositories
  • Repository cleanup: Removes repositories that no longer exist in GitHub
  • Proper intervals: Mirrors respect your configured sync intervals (not Gitea/Forgejo's default 24h)
  • Smart scheduling: Only syncs repositories that need updating
  • Auto-start on boot (v3.5.3+): Automatically imports and mirrors all repositories when SCHEDULE_ENABLED=true or GITEA_MIRROR_INTERVAL is set - no manual clicks required!

Configuration via Web Interface (Recommended)

Navigate to the Configuration page and enable "Automatic Syncing" with your preferred interval.

Configuration via Environment Variables

** Set it and forget it!** With these environment variables, Gitea Mirror will automatically:

  1. Import all your GitHub repositories on startup (no manual import needed!)
  2. Mirror them to Gitea/Forgejo immediately
  3. Keep them synchronized based on your interval
  4. Auto-discover new repos you create/star on GitHub
  5. Clean up repos you delete from GitHub
…

Important Notes:

  • Auto-Start: When SCHEDULE_ENABLED=true or GITEA_MIRROR_INTERVAL is set, the service automatically imports all GitHub repositories and mirrors them on startup. No manual "Import" or "Mirror" button clicks required!
  • The scheduler checks every minute for tasks to run. The GITEA_MIRROR_INTERVAL determines how often each repository is actually synced. For example, with 8h, each repo syncs every 8 hours from its last successful sync.
  • Large repo bootstrap: For first-time mirroring of large repositories (especially with metadata/LFS), avoid very short intervals (for example 5m). Start with a longer interval (1h to 8h) or temporarily disable scheduling during the initial import/mirror run, then enable your regular interval after the first pass completes.
  • Why this matters: If your Gitea/Forgejo instance takes a long time to complete migrations/imports, aggressive schedules can cause repeated retries and duplicate-looking mirror attempts.

️ Backup Protection Features:

  • No Accidental Deletions: Repository cleanup is automatically skipped if GitHub is inaccessible (account deleted, banned, or API errors)
  • **Archive Never D

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptbackupdockerforgejogitea

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理