2
17
Fork
You've already forked migrate-github-to-codeberg
1
[MIRROR] Effortlessly migrate GitHub repositories to Codeberg! Seamlessly transfer project. Powered by Bash, curl, and jq.
  • Shell 100%
Rahul Martim Juliato 78f3c986f3 fix: properly escape repo descriptions in JSON payload
Use jq to build the migration request body instead of shell string
interpolation, preventing 422 errors when descriptions contain special
characters (e.g. double quotes). Also improve error output to display
the actual message returned by Codeberg instead of just the HTTP status
code.
Probably fixes #3 too.
2026年02月18日 11:09:29 -03:00
LICENSE Initial commit 2024年04月28日 16:42:13 -03:00
migrate_github_to_codeberg.sh fix: properly escape repo descriptions in JSON payload 2026年02月18日 11:09:29 -03:00
README.org doc: update script name 2025年12月30日 10:41:17 -03:00

GitHub to Codeberg Migration Script

Overview

This script automates the migration of GitHub repositories to Codeberg. It allows you to seamlessly transfer your projects from GitHub to Codeberg while preserving their metadata, such as descriptions and access permissions.

Features

  • Migrate all or selected repositories from GitHub to Codeberg.
  • Customizable prefix for repository descriptions.
  • Customizable filter for repository owners.
  • Supports pagination for fetching large numbers of repositories.
  • Error handling for repository migration failures.

Limitations

Due to the complex nature of both Github and Codeberg apis, it was a design choice for this script to omit several features like:

  • distinction between forks and original repositories
  • wiki
  • pull requests
  • avatars for projects

...and so on. Please modify this script to your own needs.

Usage

Configure User Settings

  • Open the script file (migrate_github_to_codeberg.sh) in a text editor.
  • Update the user configuration section with your GitHub and Codeberg credentials.
  • Optionally, define the repositories you want to migrate by adding their names to the REPOSITORIES array.
  • Optionally, define the owners of the repositories that you want to migrate by adding their usernames to the OWNERS array.

Install Dependencies

  • Ensure that curl and jq are installed on your system.

    • On Debian/Ubuntu: sudo apt install curl jq
    • On macOS with Homebrew: brew install curl jq

Run the Script

  • Execute the script by running ./migrate_repositories.sh in your terminal.
  • Follow the on-screen instructions to proceed with the migration.
  • Press ENTER to start the migration process.

Monitor Progress

  • The script will display information about the migration progress, including successful migrations and any errors encountered.

Review Results

  • Once the migration is complete, review the results to ensure all desired repositories have been migrated successfully.

Requirements

  • Bash shell
  • curl
  • jq (JSON processor)

Screenshots (in text mode)

 ----------------------------------------------
 Welcome to Github to Codeberg Migration Script
 ----------------------------------------------
 User on Github : LionyxML
 User on Codeberg : LionyxML
 Using description prefix: [MIRROR]
 Migrating repos owned by: all users
 Migrating repo : aa
 Migrating repo : dotfiles
 Migrating repo : flycheck
 Migrating repo : my_emacs_config
 If you wish to change this, abort and change this script.
 Press ENTER to continue, C-c to abort.
>>> Working...
>>> Migrating: aa... Error! Already exists on Codeberg.
>>> Migrating: flycheck... Success!
>>> Migration complete!
 ----------------------------------------------
 Welcome to Github to Codeberg Migration Script
 ----------------------------------------------
 User on Github : LionyxML
 User on Codeberg : LionyxML
 Using description prefix: [MIRROR]
 Migrating repos owned by: LionyxML
 Migrating repo : all
 If you wish to change this, abort and change this script.
 Press ENTER to continue, C-c to abort.
>>> Working...
>>> Migrating: 100_computer_science_concepts... Error! Already exists on Codeberg.
>>> Migrating: 10_design_patterns... Error! Already exists on Codeberg.
>>> Migrating: aa... Error! Already exists on Codeberg.