github2forgejo/README.md
2025-08-19 10:20:03 +09:00

1.5 KiB

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 https://git.jeena.net/jeena/github2forgejo.git
    cd github2forgejo
    
  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

cp env-example .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