Skip to main content

This tool can be used to back up users' GitHub repositories in case they need them later.

Project description

Github Dumper

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:

pip install -U dump-github

Usage:

usage: dump-github [-h] [-d] [-p] [--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
  --token TOKEN         GitHub personal access token (or set GITHUB_TOKEN)
  --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 (GET /users/{username}/repos): sent as Bearer on the REST API.
  • Clone (default mode): HTTPS clone URL is turned into https://x-access-token:<token>@github.com/... so git clone can access private repos.
  • 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 → SettingsDeveloper settingsPersonal 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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dump_github-0.1.8-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file dump_github-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: dump_github-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for dump_github-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 75c4805bb09956ff0e909398a1431c8150ec879b0abb4b9a44aff4fbaf492cde
MD5 d93ffe64eac1a8ebbb289cf7b4c3a0d6
BLAKE2b-256 04f198cb981ed7e6f4d05a0e698f0a1a9c5550058a4f03897fdec9e0eb68fb75

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page