DEV Community

Michael Smith
Michael Smith

Posted on

Moving from GitHub to Codeberg, for Lazy People

Moving from GitHub to Codeberg, for Lazy People

Meta Description: Moving from GitHub to Codeberg, for lazy people has never been easier. This step-by-step guide covers migration tools, scripts, and shortcuts to move all your repos fast.


TL;DR: You can migrate all your GitHub repositories to Codeberg in under an hour using Codeberg's built-in import tool or a simple shell script — no manual cloning required. This guide shows you the laziest possible path to making the switch, with zero fluff.


Why Bother Moving from GitHub to Codeberg?

Let's be honest: GitHub works fine. Microsoft bought it in 2018, it has a massive community, and most open-source projects live there. So why would you move?

Here's what's been pushing developers toward Codeberg over the past few years:

  • Privacy and data sovereignty — Codeberg is run by a German non-profit (Codeberg e.V.) and operates under EU data protection law (GDPR). GitHub is a US company subject to US surveillance laws.
  • No dark patterns or upsells — Codeberg doesn't try to sell you Copilot subscriptions every time you open a tab.
  • Open source infrastructure — Codeberg runs on Gitea (now Forgejo), which is fully open source. You can see exactly what software is running your code.
  • No algorithmic feed — It's just... a Git host. That's it.
  • Microsoft dependency — Some developers are uncomfortable with a single corporation controlling the dominant code hosting platform, CI/CD (Actions), package registry (npm via GitHub), and AI coding assistant (Copilot).

None of this means you have to burn your GitHub account to the ground. Most developers end up mirroring repos to Codeberg rather than doing a hard cutover — and that's a completely valid approach.

[INTERNAL_LINK: open source alternatives to GitHub]


What You're Actually Moving (And What You're Not)

Before diving into migration, let's be realistic about what transfers cleanly and what doesn't.

What Migrates Well

Asset Migration Difficulty Notes
Git repository (code + history) ✅ Easy Full commit history preserved
Issues ✅ Easy Via Codeberg's import tool
Pull Requests ⚠️ Partial Imported as issues, not PRs
Labels ✅ Easy Imported automatically
Milestones ✅ Easy Imported automatically
Wiki ⚠️ Manual Needs separate clone/push
GitHub Actions ❌ Hard Must rewrite for Forgejo Actions
GitHub Pages ❌ Incompatible Use Codeberg Pages instead
Packages (npm, Docker) ❌ Not supported Codeberg has no package registry
Stars ❌ Not transferable Starts from zero

What You're Leaving Behind

GitHub Actions is the biggest pain point. If you have complex CI/CD pipelines, budget time to rewrite them. The good news: Forgejo Actions uses the same YAML syntax as GitHub Actions, so many workflows migrate with minimal changes. Simple pipelines often work with just a few tweaks.

GitHub Packages (container registry, npm, etc.) has no equivalent on Codeberg yet. If you rely on this, you'll want to keep a GitHub presence or move to a dedicated registry.


The Lazy Migration: Step-by-Step

Let's get to the actual lazy approach. There are three tiers of laziness here — pick the one that matches your energy level.

Tier 1: Maximum Laziness (Codeberg's Built-In Import)

Codeberg has a built-in migration tool that pulls directly from GitHub. This handles repositories, issues, labels, and milestones without you touching a terminal.

Steps:

  1. Create a Codeberg account if you haven't already (it's free)
  2. Click the "+" button in the top-right corner
  3. Select "New Migration"
  4. Choose "GitHub" as the source
  5. Enter your GitHub personal access token (needed to avoid rate limits and access private repos)
  6. Select which repositories to import
  7. Hit Migrate and go make a coffee

Generating a GitHub token for migration:

  • Go to GitHub → Settings → Developer Settings → Personal Access Tokens → Tokens (classic)
  • Create a token with repo scope (and read:org if you're migrating organization repos)
  • Paste it into Codeberg's migration form

This process typically takes 2–10 minutes per repository depending on size and issue count. For most personal projects, you'll be done before that coffee is ready.

Honest assessment: The built-in importer is excellent for code and issues. Pull requests come in as issues with a "PR" label, which is clunky but workable. If your project has hundreds of open PRs, this will annoy you. If you have five, you won't care.

Tier 2: Moderate Laziness (Shell Script for Bulk Migration)

If you have dozens of repositories and don't want to click through the UI for each one, a shell script using the Codeberg API is your friend.

This script uses the GitHub CLI to list your repos and the Codeberg API to trigger migrations:

#!/bin/bash
# Bulk migrate GitHub repos to Codeberg
# Requirements: curl, jq, gh CLI

GITHUB_USER="your-github-username"
GITHUB_TOKEN="your-github-token"
CODEBERG_USER="your-codeberg-username"
CODEBERG_TOKEN="your-codeberg-token"

# Get list of your GitHub repos
repos=$(gh repo list $GITHUB_USER --limit 100 --json name -q '.[].name')

for repo in $repos; do
  echo "Migrating: $repo"
  curl -s -X POST "https://codeberg.org/api/v1/repos/migrate" \
    -H "Content-Type: application/json" \
    -H "Authorization: token $CODEBERG_TOKEN" \
    -d "{
      \"clone_addr\": \"https://github.com/$GITHUB_USER/$repo\",
      \"auth_token\": \"$GITHUB_TOKEN\",
      \"uid\": 0,
      \"repo_name\": \"$repo\",
      \"mirror\": false,
      \"private\": false,
      \"issues\": true,
      \"labels\": true,
      \"milestones\": true
    }"
  sleep 2  # Be polite to the API
done
Enter fullscreen mode Exit fullscreen mode

Replace the variables at the top with your credentials, make it executable (chmod +x migrate.sh), and run it. Go watch an episode of something. Come back to migrated repos.

Note: Set "mirror": true if you want Codeberg to automatically sync with GitHub going forward — useful if you're not ready to fully commit to the switch.

Tier 3: The Coward's Migration (Mirroring)

Not ready to leave GitHub entirely? Set up Codeberg as a mirror. Your code lives on both platforms, Codeberg stays in sync automatically, and you can gradually shift your workflow without a hard cutover.

To set up mirroring:

  1. Use the same import tool as Tier 1
  2. Check the "This repository will be a mirror" option
  3. Set your sync interval (hourly or daily works fine)

Codeberg will pull updates from GitHub on your chosen schedule. You keep your GitHub presence, your GitHub Actions keep working, and you start building a Codeberg presence simultaneously.

This is genuinely the laziest long-term strategy. You're not really "moving" — you're just... also being on Codeberg.

[INTERNAL_LINK: self-hosted Git alternatives]


Updating Your Local Remotes

Once your repos are on Codeberg, you'll want your local clones pointing there. This is two commands per repo:

# Check current remote
git remote -v

# Update origin to Codeberg
git remote set-url origin https://codeberg.org/YOUR_USERNAME/REPO_NAME.git

# Verify
git remote -v
Enter fullscreen mode Exit fullscreen mode

If you want to push to both GitHub and Codeberg simultaneously (useful during transition):

git remote set-url --add --push origin https://codeberg.org/YOUR_USERNAME/REPO_NAME.git
git remote set-url --add --push origin https://github.com/YOUR_USERNAME/REPO_NAME.git
Enter fullscreen mode Exit fullscreen mode

Now a single git push sends to both. Extremely lazy. Highly recommended.


Migrating GitHub Actions to Forgejo Actions

This is the part where "lazy" gets harder. If you have CI/CD pipelines, you'll need to do some work.

The Good News

Forgejo Actions uses the same YAML syntax as GitHub Actions. A basic workflow like this:

name: CI
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run tests
        run: npm test
Enter fullscreen mode Exit fullscreen mode

...works on Codeberg with zero changes for many common tasks. The runs-on: ubuntu-latest label works, and many actions/ marketplace actions are compatible.

The Bad News

  • Some GitHub-specific actions (anything that integrates with GitHub's own services) won't work
  • The Forgejo Actions runner ecosystem is smaller than GitHub's
  • Secrets management works similarly but needs to be reconfigured in Codeberg's settings

Practical approach: Copy your workflow files as-is, push to Codeberg, and see what breaks. Fix only what breaks. For most Node.js, Python, and Go projects, this is a 15-minute job.

[INTERNAL_LINK: Forgejo Actions tutorial]


Setting Up Codeberg Pages (Replacing GitHub Pages)

If you use GitHub Pages for a personal site or documentation, Codeberg Pages is the equivalent. The setup is slightly different:

  • Your repo must be named pages (for your main user page at username.codeberg.page)
  • Or use a branch named pages in any repo for project pages
  • Static files go in the root or a /public directory

If you use a static site generator like Hugo or Jekyll, you'll need a Forgejo Actions workflow to build and deploy. Hugo has excellent documentation for this, and Codeberg's own docs include copy-paste workflow examples.


Honest Pros and Cons of Codeberg vs GitHub in 2026

Codeberg Wins

  • Ethics and transparency — Non-profit, open source software, GDPR-compliant
  • No surveillance capitalism — Your activity isn't being fed into AI training data without consent
  • Simplicity — Faster, less cluttered interface
  • Community — Smaller but genuinely committed to open source values

GitHub Still Wins

  • Ecosystem size — More integrations, more third-party tools, more developers
  • GitHub Actions marketplace — Thousands of pre-built actions
  • Copilot integration — If you use AI coding assistance
  • GitHub Packages — Container and package registry built-in
  • Discoverability — Open source projects get more visibility on GitHub

The Honest Verdict

For personal projects, open-source work, and anything where privacy matters: Codeberg is genuinely great and the migration is easy. For work projects with complex CI/CD, team collaboration tools, or GitHub-specific integrations: the switching cost is real and you should weigh it honestly.

Most developers end up using both. That's not fence-sitting — it's pragmatic.


Key Takeaways

  • Codeberg's built-in importer handles code, issues, labels, and milestones in a few clicks — no terminal required
  • Shell scripts + the Codeberg API can bulk-migrate dozens of repos with minimal effort
  • Mirroring is the laziest long-term strategy — stay on both platforms with automatic sync
  • Forgejo Actions is largely compatible with GitHub Actions YAML — most simple pipelines work with zero changes
  • GitHub Packages and complex Actions integrations are the main pain points with no easy workaround
  • git remote set-url is your friend for updating local clones
  • You don't have to fully commit — partial migration is a valid, common approach

Frequently Asked Questions

Q: Will my GitHub stars and followers transfer to Codeberg?

No. Stars, followers, and watch counts are platform-specific social data. You start from zero on Codeberg. If this matters for your project's credibility, consider keeping a GitHub mirror active so your social proof stays visible there.

Q: Can I keep my GitHub account active while using Codeberg?

Absolutely. Most developers who migrate don't delete their GitHub accounts — they either mirror repos or simply stop updating them. There's no rule against being on both platforms.

Q: Is Codeberg free? What are the limits?

As of early 2026, Codeberg is free for public and private repositories with no artificial repo limits. It's funded by donations to Codeberg e.V. You can support them at codeberg.org/donate. There are soft limits on repository size (1GB recommended maximum per repo) and Actions runner minutes, but these rarely affect normal usage.

Q: How long does migration actually take?

For a single repository with code and issues: 2–10 minutes using the built-in importer. For 20–30 repositories using a script: 30–60 minutes of automated work (most of which you can ignore). The CI/CD rewrite is the wildcard — budget 15 minutes to 2 hours depending on complexity.

Q: What happens to links pointing to my GitHub repositories?

They keep working — GitHub doesn't delete your repos when you stop using them (unless you delete them yourself). If you want to redirect traffic, you can add a notice in your GitHub repo's README pointing to the Codeberg URL. Some developers pin a "This project has moved" issue to make it clear.


Ready to Make the Move?

The honest truth about moving from GitHub to Codeberg, for lazy people, is this: the hard part is deciding to do it. The actual technical work — for most developers — is an afternoon at most.

Start with Codeberg's built-in importer on your most important personal project. See how it feels. If you like it, run the bulk script on the rest. If you're not ready to commit, set up mirroring and let future-you decide.

Create your free Codeberg account at codeberg.org — and if you find it valuable, consider donating to support the project. Non-profits running critical open source infrastructure deserve our support.

Got questions about your specific migration scenario? Drop them in the comments below — the specifics of Actions workflows and edge cases are worth discussing.

Top comments (0)