Skip to main content

Github Dumper

CI PyPI

Github Dumper is a Python program designed to search for users' GitHub repositories and download the repositories. This tool can be used to back up users' GitHub repositories in case they need them later.

Install (Python 3.10+):

pip install -U dump-github

Usage:

usage: dump-github [-h] [-d] [-p] [--version] [--token TOKEN]
                   [--limit_size LIMIT_SIZE]
                   username

Backup users github repo.

positional arguments:
  username

options:
  -h, --help            show this help message and exit
  -d, --download_zip    only download zip file
  -p, --print           only print urls
  --version             show program's version number and exit
  --token TOKEN         GitHub personal access token (or set GITHUB_TOKEN).
                        Required for private repos and higher API rate limits.
  --limit_size LIMIT_SIZE
                        limit size(MB) of download zip file, if 0 then no
                        limit(default:100).

https://github.com/Core2002/dump_github

Authentication (token)

GitHub’s API requires a proper Authorization: Bearer <token> header. This tool accepts a personal access token in two ways (first match wins):

  1. --token on the command line
  2. GITHUB_TOKEN environment variable (if --token is empty)

Why use a token?

  • Private repositories: Without a token, only public repos are listed and can be cloned or archived. With a token that has the right scopes, you can include private repos you are allowed to access (for example when backing up your own account).
  • Rate limits: Authenticated API requests get a much higher limit than anonymous requests.

How the token is used

  • Listing repos: sent as Bearer on the REST API and scoped strictly to the requested account:

    • organisation → GET /orgs/{org}/repos?type=all — only repositories owned by that organisation (private ones included when the token may access them);
    • your own user account → GET /user/repos?affiliation=owner — private and public repos, without organisation/collaborator repos;
    • any other user → GET /users/{username}/repos?type=owner.

    Repositories whose owner is not the requested account are discarded as a final guard, so a user dump never includes organisation repositories and an organisation dump never includes user repositories.

  • Clone (default mode): the token is handed to git through a one-shot credential helper (credential.helper reads DUMP_GITHUB_TOKEN from the child process environment), so the clone URL stays https://github.com/.... The token is never shown in ps output and never written to the cloned repository's .git/config; existing credential helpers are reset for that clone so a stale stored credential cannot shadow the token.

  • Zip download (-d): uses the repository archive (zipball) API with the same Bearer header (via curl), which works for private repos; without a token, public archive URLs are used instead.

Create a token under GitHub → Settings → Developer settings → Personal access tokens. For private repo backup, enable access to repository contents (classic PAT: repo scope; fine-grained: read access to the repositories you need).

Examples

# Public repos only (no token)
dump-github Core2002 -p

# Token on the command line (private + higher API limits)
dump-github username --token ghp_xxxxxxxxxxxx

# Back up an organisation (only that organisation's repositories)
dump-github some-org --token ghp_xxxxxxxxxxxx

# Same, via environment variable (recommended to avoid shell history)
export GITHUB_TOKEN=ghp_xxxxxxxxxxxx
dump-github Core2002 -d

Security note: Do not commit tokens or paste them into shared logs. Prefer GITHUB_TOKEN in a local shell profile or a secret manager, and rotate the token if it leaks. Cloned repositories keep a clean remote URL (https://github.com/...), so .git/config does not contain the token.

Development

python -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
python -m pip install -e ".[dev]"
python -m unittest discover -s tests -v
python -m build                  # dist/: sdist + wheel
python -m twine check dist/*

CI runs the test suite on Python 3.10, 3.12 and 3.13, and checks the build metadata with twine check (.github/workflows/ci.yml).

Releasing

  1. Bump __version__ in dump_github/_version.py and move the changelog entries in CHANGELOG.md to the new version.
  2. Commit, tag and push:
    git tag v0.2.0
    git push origin main v0.2.0
    
  3. The Release workflow runs the tests, builds the sdist and wheel, checks them with twine check and publishes both to PyPI through Trusted Publishing.

One-time setup on PyPI: add a trusted publisher for the Core2002/dump_github repository and the release.yml workflow. No PyPI API token is stored in the repository. Manual fallback:

python -m build
python -m twine upload dist/*

Metadata

Release files for dump-github 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dump-github 0.2.0
File Size Uploaded Provenance Actions
dump_github-0.2.0.tar.gz 12.0 kB With provenance Details for dump_github-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dump-github 0.2.0
File Interpreter ABI Platform Actions
dump_github-0.2.0-py3-none-any.whl Python 3 none any Details for dump_github-0.2.0-py3-none-any.whl

Total release size: 20.9 kB

Release files / dump_github-0.2.0.tar.gz

Download URL dump_github-0.2.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
184da28b5529dc179e6a3d5a49ed1050471a3b50ce9791f950cfbe6ea409b483
BLAKE2b-256 checksum
How to use checksums
3b5dca0f2a4ae77e057ca76745453e1481a173a194e9138760e5c13735bb3fc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / dump_github-0.2.0-py3-none-any.whl

Download URL dump_github-0.2.0-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
435e98203d8c6ec0faa5fd41b69e52f0b506cfefa1d6da90ac414bdbff9a7ec2
BLAKE2b-256 checksum
How to use checksums
1d24a503d2f044c0b4dd8463f63136c8ff66677f6ca4edab120da05f5e34f0ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for dump-github 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dump_github-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page