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.

Without a token

Only public repositories can be listed and downloaded. The anonymous GitHub API allows 60 requests per hour per IP, which shared/NATed networks and CI runners exhaust quickly; if api.github.com is rate-limited or otherwise unavailable, the tool automatically falls back to the public GitHub web listing (github.com/{user}?tab=repositories / github.com/orgs/{org}/repositories), prints a warning and keeps going. Private repositories still require a token.

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; falls back to the web listing if the API is rate-limited)
dump-github Core2002 -p

# Public backup without any credentials
dump-github Core2002 -d

# 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.1

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.1
File Size Uploaded Provenance Actions
dump_github-0.2.1.tar.gz 17.4 kB With provenance Details for dump_github-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 28.4 kB

Release files / dump_github-0.2.1.tar.gz

Download URL dump_github-0.2.1.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0329871d6d757687687d1b426df91280e3cfb97296dcf67f8ddc46d50674c73b
BLAKE2b-256 checksum
How to use checksums
c38eb16e1b921a3c7274c7ba58ae19910d440e021102276a6b6edca097b1a6f9
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.1-py3-none-any.whl

Download URL dump_github-0.2.1-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
349823b75bd3d8883c41693cb939f06b2f93d0be7708ba084c46ce96682bceb3
BLAKE2b-256 checksum
How to use checksums
b87be403539e72b374dc0da3a7b132e6445e4f06c89ebaebf7cf5612f6ad81bc
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.1

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.1.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