1.5 KiB
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
-
Clone this repository:
git clone https://git.jeena.net/jeena/github2forgejo.git cd github2forgejo
-
Install dependencies with Pipenv:
pipenv install
Authentication
You need to create personal access tokens for both GitHub and Forgejo.
GitHub Token
- Go to GitHub Personal Access Tokens.
- 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)
- Copy the generated token.
Forgejo Token
- Log into your Forgejo instance.
- Go to Settings → Applications → Manage Access Tokens.
- Create a token with these scopes:
repository (read/write)
issue (read/write)
misc (read/write)
user (read/write)
- 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