This script helps you clone all repositories of a given list of GitHub users (including organizations) at once, instead of cloning them manually one by one.
I built it after running into the need to archive and collect repositories from multiple accounts efficiently. The goal was simple: automate bulk cloning in a clean, repeatable way.
What It Does
- Accepts multiple GitHub usernames
- Fetches all accessible repositories via the GitHub API
- Clones them into a structured local directory
- Supports shallow clone (
--depth 1) or full history - Skips repositories that are inaccessible or already cloned
Each user gets their own folder inside the target directory.
Requirements
- Python 3.12+
-
gitinstalled and available in PATH - A GitHub Personal Access Token with read access to repository contents
Setup
-
Generate a Personal Access Token:
- Go to GitHub → Settings → Developer settings → Personal access tokens
- Create a token with repository read access
Copy
sample.envto.envReplace the placeholder token value with your actual token
Install dependencies:
pip install -r requirements.txt
Usage
Run:
python github-main.py
You’ll be prompted for:
- A space-separated list of GitHub usernames
- A target directory (default:
mass_clone_output) - Clone depth (
Nonefor full history or1for latest commit only)
The script validates usernames, fetches repositories, and clones them sequentially with live git clone output shown in the terminal.
Top comments (0)