Skip to main content

Backup and archive Git Repos and Gists from GitHub

Project description

githubtakeout

Backup and archive Git Repos and Gists from GitHub

Development GitHub
License MIT
Releases
Supported Python Versions

About:

githubtakeout is a data export tool for backing up and archiving Git repositories hosted on GitHub. It clones a user's repos and creates an archive of each.

It supports public/private repos and public/secret gists. By default, it doesn't save commit history or branches (.git directory), or Gist repositories (both can be enabled with command line options).

When you run the program, archives of your repos will be saved in a directory named backups inside your current working directory, unless a different location is specified using the --dir option.

Archives are saved in compressed zip format (.zip) by default. You can also save as tarballs (.tar.gz) using the --format=tar option, or skip archiving using the --format=none option.

If a repo with history exists from a previous run, it will pull new changes. Otherwise, it will clone the repo. Use the --keep if you don't want repos deleted after an archive is created.

Requirements:

  • Python 3.12+
  • Git 1.7+

Installation:

Install from PyPI:

pip install githubtakeout

Authentication:

By default, githubtakeout will only retrieve an account's public repos. To access private repos and secret gists, you need to authenticate.

First, you must create a personal access token on Github (either a fine-grained or classic personal access token). Once you have a token, you can set the GITHUB_TOKEN environment variable:

$ export GITHUB_TOKEN=<access token>

You can also set this in an .env file in the current directory. It should contain:

GITHUB_TOKEN=<access token>

If you prefer to be prompted for your token each time you run the program, use the --token argument.

CLI Options:

$ githubtakeout --help
usage: githubtakeout [-h] [--dir DIR] [--pattern PATTERN] [--skip_pattern PATTERN]
                     [--format {tar,zip,none}] [--gists] [--history]
                     [--skip_forks] [--keep] [--list] [--token]
                     username

positional arguments:
  username                 github username

options:
  -h, --help               show this help message and exit
  --dir DIR                output directory (default: .)
  --pattern PATTERN        regex matching repo names to include
  --skip_pattern PATTERN   regex matching repo names to skip
  --format {tar,zip,none}  archive format (default: zip)
  --gists                  include gists
  --history                include commit history and branches (.git directory)
  --skip_forks             skip repos that are forks
  --keep                   keep repos after archiving
  --list                   list repos only
  --token                  prompt for auth token

Screenshot:

Screenshot

Usage Examples:

Install from PyPI with pipx, Run:

pipx install githubtakeout
githubtakeout <github username>

Clone Repo, Create/Activate Virtual Environment, Install from Source, Run:

git clone git@github.com:cgoldberg/githubtakeout.git
cd ./githubtakeout
python3 -m venv venv
source venv/bin/activate
pip install .
githubtakeout <github username>

Project details


Download files

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

Source Distribution

githubtakeout-0.1.25.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

githubtakeout-0.1.25-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file githubtakeout-0.1.25.tar.gz.

File metadata

  • Download URL: githubtakeout-0.1.25.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for githubtakeout-0.1.25.tar.gz
Algorithm Hash digest
SHA256 7f21a9434a82dd7e9dde223f86819bae199a2f89af23a1179b529e44eab0b69c
MD5 38ca3b9d03f9acee3ad0185969c5a49e
BLAKE2b-256 1d903879c7fd8b2c98dd3574638dc3c36722e3fafb10ffd3c6a7ace67642de1a

See more details on using hashes here.

File details

Details for the file githubtakeout-0.1.25-py3-none-any.whl.

File metadata

  • Download URL: githubtakeout-0.1.25-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for githubtakeout-0.1.25-py3-none-any.whl
Algorithm Hash digest
SHA256 d705313c351ae8b81bf8eecbfdeefff96fc90de7357b546940a35d302671fdbb
MD5 f07a1fbd679d01cc7241600f12536c96
BLAKE2b-256 c0aa0b0ef49db8e267bab09f22a7d1de6f37925a997749c80a92d335e9044d5b

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