Metadata-Version: 2.4
Name: githubtakeout
Version: 0.1.24
Summary: Backup and archive Git Repos and Gists from GitHub
Author: Corey Goldberg
Maintainer: Corey Goldberg
License-Expression: MIT
Project-URL: homepage, https://github.com/cgoldberg/githubtakeout
Project-URL: source, https://github.com/cgoldberg/githubtakeout
Project-URL: download, https://pypi.org/project/githubtakeout
Keywords: git,github,archive,backup,export,takeout
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: GitPython==3.1.46
Requires-Dist: PyGithub==2.9.1
Requires-Dist: python-dotenv==1.2.2
Requires-Dist: rich==15.0.0
Dynamic: license-file

# githubtakeout

## Backup and archive Git Repos and Gists from GitHub

- Copyright (c) 2015-2026 [Corey Goldberg](https://github.com/cgoldberg)

<table>
  <tr>
    <td>Development</td>
    <td>
      <a href="https://github.com/cgoldberg/githubtakeout">
        GitHub
      </a>
    </td>
  </tr>
  <tr>
    <td>License</td>
    <td>
      <a href="https://raw.githubusercontent.com/cgoldberg/githubtakeout/refs/heads/master/LICENSE">
        MIT
      </a>
    </td>
  </tr>
  <tr>
    <td>Releases</td>
    <td>
      <a href="https://pypi.org/project/githubtakeout">
        <img src="https://img.shields.io/pypi/v/githubtakeout.svg">
      </a>
    </td>
  </tr>
  <tr>
    <td>Supported Python Versions</td>
    <td>
      <a href="https://pypi.org/project/githubtakeout">
        <img src="https://img.shields.io/pypi/pyversions/githubtakeout">
      </a>
    </td>
  </tr>
</table>

----

## 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](https://pypi.org/project/githubtakeout):

```
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](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
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](https://raw.githubusercontent.com/cgoldberg/githubtakeout/refs/heads/master/screenshot.png)

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