No description
Find a file
2025-08-19 10:13:22 +09:00
.gitignore Initial commit 2025-08-19 10:13:22 +09:00
env-example Initial commit 2025-08-19 10:13:22 +09:00
migrate_github_to_forgejo.py Initial commit 2025-08-19 10:13:22 +09:00
Pipfile Initial commit 2025-08-19 10:13:22 +09:00
Pipfile.lock Initial commit 2025-08-19 10:13:22 +09:00
README.md Initial commit 2025-08-19 10:13:22 +09:00

GitHub to Forgejo Migration Script

This repository contains a Python script to migrate repositories from GitHub to Forgejo.
It supports private and public repositories owned by the authenticated GitHub user.

Setup

  1. Clone this repository:

    git clone git@your-forgejo-instance:username/github-to-forgejo.git
    cd github-to-forgejo
    
  2. Install dependencies with Pipenv:

    pipenv install
    

Authentication

You need to create personal access tokens for both GitHub and Forgejo.

GitHub Token

  1. Go to GitHub Personal Access Tokens.
  2. Create a new classic token with the following scopes:
    • repo (required for private repos)
    • read:project (if you want project boards)
    • read:org (optional, if repos are in orgs)
    • read:discussion (optional, usually not needed)
  3. Copy the generated token.

Forgejo Token

  1. Log into your Forgejo instance.
  2. Go to Settings → Applications → Manage Access Tokens.
  3. Create a token with these scopes:
    • repository (read/write)
    • issue (read/write)
    • misc (read/write)
    • user (read/write)
  4. Copy the generated token.

.env file

The settings are stored in the .env file. Copy the env-example file and call it .env

Put in both tokens and fill in the rest accordingly like usernames and URLs.

Usage

Run the script to migrate repositories:

pipenv run python migrate_github_to_forgejo.py