1 Migrate To Codeberg
Drew edited this page 2026-05-02 01:52:01 -04:00

Migrating to Forgejo / Codeberg

A practical migration guide for moving repositories from GitHub to Codeberg.


Why Codeberg

Non-profit, community-governed, runs on Forgejo (open source), European privacy standards, zero cost forever.

See Thoughts Codeberg for the reasoning.


Migration approach

Phase 1: dual presence

Keep GitHub active, mirror repos to Codeberg, add notices to READMEs.

Phase 2: Codeberg primary

New development on Codeberg. GitHub becomes read-only mirror.

Phase 3: archive GitHub

Archive repos with forwarding notices. Maintain mirrors for backwards compatibility.


Setting up a mirror

# Add Codeberg as primary origin
git remote rename origin github
git remote add origin git@codeberg.org:YOUR_USERNAME/REPO.git
git push -u origin main

Repository migration notice

Add to GitHub README:

# This Repository Has Moved

**New location**: https://codeberg.org/YOUR_USERNAME/REPO_NAME

All new development happens on Codeberg.
Issues and PRs should be opened there.
This repo remains as a read-only mirror.

Auto-mirror via GitHub Action

name: Mirror to GitHub
on:
  push:
    branches: [ main ]
jobs:
  mirror:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: 0
    - name: Push to GitHub Mirror
      run: |
        git remote add github \
          https://x-access-token:${{ secrets.GITHUB_TOKEN }}\
          @github.com/${{ github.repository }}.git
        git push github main --force

Resources