No description
Find a file
2026-06-13 23:25:31 +02:00
.gitignore initial commit 2026-06-13 23:25:31 +02:00
forgejo-repo-creator-and-git-pusher.py initial commit 2026-06-13 23:25:31 +02:00
github-mass-downloader.py initial commit 2026-06-13 23:25:31 +02:00
README.md initial commit 2026-06-13 23:25:31 +02:00

Python scripts for downloading GitHub repositories to a local directory and migrating local Git repositories to a Forgejo (and probably Gitea as well) instance.

Setup

  1. Create and activate a virtual environment:
    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  2. Install dependencies:
    pip install requests
    

Configuration

Edit the top-level variables in each script before execution.

github_backup.py

  • TOKEN: GitHub Personal Access Token with sufficient permissions.

forgejo_migration.py

  • FORGEJO_BASE: Base URL of your Forgejo instance (e.g., https://git.maidsin.space).
  • FORGEJO_API_TOKEN: Forgejo access token with sufficient permissions.
  • FORGEJO_USER: Your Forgejo username.
  • FORGEJO_PASS: Your Forgejo account password (used for Git credential helper fallback).
  • BACKUP_DIR: Absolute or relative path to the directory containing local Git repositories to migrate.

Usage

Step 1: Backup GitHub Repositories Clone all repositories associated with the GitHub token:

python github_backup.py

Repositories are cloned into ./github_backups. The script fetches full history (shallow=False).

Also create a separate copy somewhere else after it's done!

Step 2: Migrate to Forgejo Create and push the local repositories to your Forgejo instance:

python forgejo_migration.py

Ensure BACKUP_DIR points to the directory containing the cloned repositories.

If it exits on errors, delete all previously pushed repos and rerun.