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.
- Migrate all or selected repositories from GitHub to Codeberg.
- Customizable prefix for repository descriptions.
- Supports pagination for fetching large numbers of repositories.
- Error handling for repository migration failures.
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.
- Open the script file (
migrate_repositories.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.
- Ensure that
curl
andjq
are installed on your system.- On Debian/Ubuntu:
sudo apt install curl jq
- On macOS with Homebrew:
brew install curl jq
- On Debian/Ubuntu:
- 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.
- The script will display information about the migration progress, including successful migrations and any errors encountered.
- Once the migration is complete, review the results to ensure all desired repositories have been migrated successfully.
- Bash shell
- curl
- jq (JSON processor)
----------------------------------------------
Welcome to Github to Codeberg Migration Script
----------------------------------------------
User on Github : LionyxML
User on Codeberg : LionyxML
Using description prefix: [MIRROR]
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 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.