No description
Find a file
2026-06-11 19:41:27 -04:00
.vscode one by one migration script 2026-03-27 16:31:51 -04:00
.env.example convert to python 2026-03-27 16:04:29 -04:00
.gitignore make migrate all script work 2026-03-27 16:26:36 -04:00
migrate-all.py match repo configurations during migration 2026-06-11 19:41:27 -04:00
migrate-one.py match repo configurations during migration 2026-06-11 19:41:27 -04:00
readme.md match repo configurations during migration 2026-06-11 19:41:27 -04:00
utils.py match repo configurations during migration 2026-06-11 19:41:27 -04:00

Gitea Migration Script

This Python script facilitates the migration of repositories from a source Gitea instance to a destination Git service (such as GitHub or another Git-compatible platform that supports repository migration via API).

Features

  • Bulk Migration: Migrate all repositories from a Gitea instance that match specified criteria
  • Single Repository Migration: Interactive migration of individual repositories
  • Comprehensive Migration: Includes pull requests, issues, labels, LFS files, milestones, releases, and wiki pages
  • Filtering: Use whitelist and blacklist to control which repositories are migrated
  • Error Handling: Graceful handling of existing repositories and API errors

Environment Variables

Set the following environment variables before running the scripts:

  • SOURCE_GITEA_TOKEN: Personal access token for the source Gitea instance
  • DESTINATION_GIT_TOKEN: Personal access token for the destination Git service
  • SOURCE_GITEA_URL: Base URL of the source Gitea instance (e.g., https://gitea.example.com)
  • DESTINATION_GIT_URL: Base URL of the destination Git service API (e.g., https://api.github.com for GitHub)
  • BLACKLIST: Comma-separated list of repository names or organizations to exclude from migration
  • OWNER_WHITELIST: Comma-separated list of organization names that are allowed for migration

Usage

Bulk Migration

Run migrate-all.py to migrate all repositories that match the whitelist criteria:

python migrate-all.py

This script will:

  1. Fetch all repositories from the source Gitea instance
  2. Filter repositories based on whitelist and blacklist
  3. Migrate each qualifying repository to the destination

Single Repository Migration

Run migrate-one.py for interactive migration of individual repositories:

python migrate-one.py

Follow the prompts to enter repository URLs one by one. The script will continue until you interrupt it (Ctrl+C).

Migration Details

The migration process includes:

  • Repository code and history
  • Pull requests
  • Issues
  • Labels
  • LFS (Large File Storage) files
  • Milestones
  • Releases
  • Wiki pages

Note: The destination service must support the repository migration API endpoint used by this script.

Error Handling

  • If a repository already exists at the destination, the script will skip it and continue
  • API errors are displayed with details
  • The script will exit on critical errors during migration

Security Notes

  • Store access tokens securely and never commit them to version control
  • Use environment variables or secure credential management
  • Ensure tokens have appropriate permissions for repository operations

Contributing

Contributions are welcome!