No description
.claude | ||
node_modules | ||
bun.lock | ||
index.js | ||
MIGRATION_WORKFLOW.md | ||
package.json | ||
README.md | ||
removeAllRepos.js |
MigrateForge
A command-line tool for migrating repositories from GitHub to Forgejo/Gitea instances with full organization support.
Features
- 🔐 Secure Authentication: GitHub Personal Access Tokens
- 🏢 Organization Support: Migrate entire organizations with name conflict resolution
- 📦 Comprehensive Migration: Issues, PRs, releases, wikis, labels, milestones, and LFS
- 🔄 Mirror Support: Keep repositories synchronized with GitHub
- 🎯 Selective Migration: Choose specific repositories to migrate
- 🏷️ Custom Naming: Flexible repository naming with JavaScript expressions
- ⚡ Rate Limiting: Intelligent retry logic with progress display
- 🎨 Beautiful UI: Colorful terminal interface with real-time progress
Installation
npm install
Usage
Run the migration tool:
npm start
The tool will guide you through:
- GitHub Authentication - Personal Access Token setup
- Forgejo/Gitea Setup - Server URL and API token creation
- Migration Options - Select what data to migrate
- Organization Transfer - Choose to migrate organizations or select individual repos
- Repository Naming - Configure how repos will be named
- Migration Execution - Real-time progress with retry logic
GitHub Authentication
Create a Personal Access Token at https://github.com/settings/tokens/new with these scopes:
repo
- Full control of private repositoriesread:org
- Read org and team membershipread:user
- Read user profile data
Forgejo/Gitea Setup
Create an API token with these permissions:
write:repository
- Create and manage repositorieswrite:organization
- Create and manage organizationswrite:user
- Manage user account
Migration Options
- Mirror Repositories - Keep repos synchronized with GitHub
- LFS Files - Migrate Git Large File Storage data
- Wiki - Migrate repository wikis
- Issues - Migrate GitHub issues
- Pull Requests - Migrate PRs (where supported)
- Labels - Migrate issue/PR labels
- Milestones - Migrate project milestones
- Releases - Migrate GitHub releases
Repository Naming
Customize how repositories are named using these variables:
{orgName}
- Original organization/user name{repoName}
- Original repository name
Examples:
{orgName}-{repoName}
- Default format{repoName}
- Keep original namesgh-{orgName}-{repoName}
- Add prefix{orgName.toLowerCase()}-{repoName}
- JavaScript expressions{orgName.replace("old", "new")}-{repoName}
- String replacement
Error Handling
- Rate Limiting: Automatic retry with exponential backoff
- Network Errors: Up to 5 retry attempts per repository
- Validation: Duplicate name detection and conflict resolution
- Progress Tracking: Real-time status updates with color coding
Requirements
- Node.js 18+
- Access to GitHub API
- Forgejo/Gitea instance with API access
- GitHub Personal Access Token with required scopes
License
MIT