• Stars
    star
    1,140
  • Rank 40,879 (Top 0.9 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

backup a github user or organization

github-backup

PyPI Python Versions

This project is considered feature complete for the primary maintainer. If you would like a bugfix or enhancement and cannot sponsor the work, pull requests are welcome. Feel free to contact the maintainer for consulting estimates if desired.

backup a github user or organization

Requirements

  • GIT 1.9+

Installation

Using PIP via PyPI:

pip install github-backup

Using PIP via Github:

pip install git+https://github.com/josegonzalez/python-github-backup.git#egg=github-backup

Usage

CLI Usage is as follows:

github-backup [-h] [-u USERNAME] [-p PASSWORD] [-t TOKEN] [--as-app]
              [-o OUTPUT_DIRECTORY] [-l LOG_LEVEL] [-i] [--starred]
              [--all-starred] [--watched] [--followers] [--following]
              [--all] [--issues] [--issue-comments] [--issue-events]
              [--pulls] [--pull-comments] [--pull-commits]
              [--pull-details] [--labels] [--hooks] [--milestones]
              [--repositories] [--bare] [--lfs] [--wikis] [--gists]
              [--starred-gists] [--skip-archived] [--skip-existing]
              [-L [LANGUAGES ...]] [-N NAME_REGEX] [-H GITHUB_HOST]
              [-O] [-R REPOSITORY] [-P] [-F] [--prefer-ssh] [-v]
              [--keychain-name OSX_KEYCHAIN_ITEM_NAME]
              [--keychain-account OSX_KEYCHAIN_ITEM_ACCOUNT]
              [--releases] [--assets] [--exclude [REPOSITORY [REPOSITORY ...]]
              [--throttle-limit THROTTLE_LIMIT] [--throttle-pause THROTTLE_PAUSE]
              USER

Backup a github account

positional arguments:
  USER                  github username

optional arguments:
  -h, --help            show this help message and exit
  -u USERNAME, --username USERNAME
                        username for basic auth
  -p PASSWORD, --password PASSWORD
                        password for basic auth. If a username is given but
                        not a password, the password will be prompted for.
  -t TOKEN, --token TOKEN
                        personal access, OAuth, or JSON Web token, or path to
                        token (file://...)
  --as-app              authenticate as github app instead of as a user.
  -o OUTPUT_DIRECTORY, --output-directory OUTPUT_DIRECTORY
                        directory at which to backup the repositories
  -l LOG_LEVEL, --log-level LOG_LEVEL
                        log level to use (default: info, possible levels:
                        debug, info, warning, error, critical)
  -i, --incremental     incremental backup
  --starred             include JSON output of starred repositories in backup
  --all-starred         include starred repositories in backup [*]
  --watched             include JSON output of watched repositories in backup
  --followers           include JSON output of followers in backup
  --following           include JSON output of following users in backup
  --all                 include everything in backup (not including [*])
  --issues              include issues in backup
  --issue-comments      include issue comments in backup
  --issue-events        include issue events in backup
  --pulls               include pull requests in backup
  --pull-comments       include pull request review comments in backup
  --pull-commits        include pull request commits in backup
  --pull-details        include more pull request details in backup [*]
  --labels              include labels in backup
  --hooks               include hooks in backup (works only when
                        authenticated)
  --milestones          include milestones in backup
  --repositories        include repository clone in backup
  --bare                clone bare repositories
  --lfs                 clone LFS repositories (requires Git LFS to be
                        installed, https://git-lfs.github.com) [*]
  --wikis               include wiki clone in backup
  --gists               include gists in backup [*]
  --starred-gists       include starred gists in backup [*]
  --skip-existing       skip project if a backup directory exists
  -L [LANGUAGES [LANGUAGES ...]], --languages [LANGUAGES [LANGUAGES ...]]
                        only allow these languages
  -N NAME_REGEX, --name-regex NAME_REGEX
                        python regex to match names against
  -H GITHUB_HOST, --github-host GITHUB_HOST
                        GitHub Enterprise hostname
  -O, --organization    whether or not this is an organization user
  -R REPOSITORY, --repository REPOSITORY
                        name of repository to limit backup to
  -P, --private         include private repositories [*]
  -F, --fork            include forked repositories [*]
  --prefer-ssh          Clone repositories using SSH instead of HTTPS
  -v, --version         show program's version number and exit
  --keychain-name OSX_KEYCHAIN_ITEM_NAME
                        OSX ONLY: name field of password item in OSX keychain
                        that holds the personal access or OAuth token
  --keychain-account OSX_KEYCHAIN_ITEM_ACCOUNT
                        OSX ONLY: account field of password item in OSX
                        keychain that holds the personal access or OAuth token
  --releases            include release information, not including assets or
                        binaries
  --assets              include assets alongside release information; only
                        applies if including releases
  --exclude [REPOSITORY [REPOSITORY ...]]
                        names of repositories to exclude from backup.
  --throttle-limit THROTTLE_LIMIT
                        start throttling of GitHub API requests after this
                        amount of API requests remain
  --throttle-pause THROTTLE_PAUSE
                        wait this amount of seconds when API request
                        throttling is active (default: 30.0, requires
                        --throttle-limit to be set)

The package can be used to backup an entire organization or repository, including issues and wikis in the most appropriate format (clones for wikis, json files for issues).

Authentication

Note: Password-based authentication will fail if you have two-factor authentication enabled.

Using the Keychain on Mac OSX

Note: On Mac OSX the token can be stored securely in the user's keychain. To do this:

  1. Open Keychain from "Applications -> Utilities -> Keychain Access"
  2. Add a new password item using "File -> New Password Item"
  3. Enter a name in the "Keychain Item Name" box. You must provide this name to github-backup using the --keychain-name argument.
  4. Enter an account name in the "Account Name" box, enter your Github username as set above. You must provide this name to github-backup using the --keychain-account argument.
  5. Enter your Github personal access token in the "Password" box

Note: When you run github-backup, you will be asked whether you want to allow "security" to use your confidential information stored in your keychain. You have two options:

  1. Allow: In this case you will need to click "Allow" each time you run github-backup
  2. Always Allow: In this case, you will not be asked for permission when you run github-backup in future. This is less secure, but is required if you want to schedule github-backup to run automatically

About Git LFS

When you use the "--lfs" option, you will need to make sure you have Git LFS installed.

Instructions on how to do this can be found on https://git-lfs.github.com.

Examples

Backup all repositories, including private ones:

export ACCESS_TOKEN=SOME-GITHUB-TOKEN
github-backup WhiteHouse --token $ACCESS_TOKEN --organization --output-directory /tmp/white-house --repositories --private

Backup a single organization repository with everything else (wiki, pull requests, comments, issues etc):

export ACCESS_TOKEN=SOME-GITHUB-TOKEN
ORGANIZATION=docker
REPO=cli
# e.g. [email protected]:docker/cli.git
github-backup $ORGANIZATION -P -t $ACCESS_TOKEN -o . --all -O -R $REPO

Testing

This project currently contains no unit tests. To run linting:

pip install flake8
flake8 --ignore=E501

More Repositories

1

php-dotenv

dotenv file loader for PHP
PHP
275
star
2

awesome-consul

A list of awesome consul projects, libraries
275
star
3

php-git

Unmaintained: A simple git-php project that enables github-like functionality with a not-so-bad stylesheet :)
PHP
160
star
4

php-queuesadilla

PHP job/worker system built to support various queuing systems
PHP
95
star
5

real-aws-status

Make the aws status page a bit more useful during outages
JavaScript
85
star
6

cakephp-elastic-search-datasource

UNMAINTAINED - CakePHP2: ElasticSearch datasource that actually behaves like a real datasource
PHP
84
star
7

cakephp-admin

CakePHP2: Deprecated in favor of https://github.com/FriendsOfCake/crud
PHP
76
star
8

cakephp-wysiwyg

CakePHP2: Unmaintained helper for various wysiwyg editors
PHP
65
star
9

cakephp-version

CakePHP3: plugin that facilitates versioned database entities
PHP
52
star
10

cakephp-filter

Deprecated
PHP
51
star
11

cakephp-environments

Deprecated CakePHP3: Environments Library as a plugin
PHP
46
star
12

python-slack-tunes

send slack away music notifications from itunes or spotify
Python
45
star
13

metricsd

golang metrics collecting agent for linux
Go
43
star
14

cakephp-webservice

CakePHP2: Takes the data you set and automatically serves it as JSON and XML
PHP
38
star
15

cakephp-purifiable

CakePHP2: Unmaintained plugin that makes your model data so fresh so clean
PHP
37
star
16

cakephp-cake-djjob

CakePHP2: unmaintained plugin that integrates seatgeek's djjob with CakePHP shells
PHP
36
star
17

cakephp-queuesadilla

CakePHP3: easily run background jobs on various message backends
PHP
34
star
18

cakephp-sanction

CakePHP2: give sanction to your users when they intend to navigate to certain portions of your website
PHP
33
star
19

php-error-handlers

Wrappers for popular error handling services
PHP
30
star
20

python-scrapilicious

Unmaintained: A horridly implemented scrapy app that will scrape all (?) of Delicious' bookmarks.
Python
28
star
21

ruby-redis-backup

Unmaintained: a small ruby gem that allows automated redis-backups
Ruby
26
star
22

cakephp-github-plugin-plugin

Deprecated
23
star
23

cakephp-annotation-control-list

CakePHP3: ACL system using controller action annotations
PHP
21
star
24

ruby-cimino

Deprecated: Jekyll blogging at it's finest. No really, even finer than Octopress ;)
CSS
21
star
25

dokku-global-cert

allows setting a global certificate for applications
Shell
20
star
26

cakephp-page-route

CakePHP2: Automagically route /:page style routes without any fuss
PHP
19
star
27

cakephp-trackable

CakePHP2: Unmaintained plugin for tracking who created/modified a record
PHP
17
star
28

sublimetext-cakephp

Native Sublime Text 2 CakePHP Package
15
star
29

cakephp-sham

CakePHP2: Unmaintained plugin that handles SEO-related information
PHP
15
star
30

cakephp-app-skellington

Deprecated: builds a barebones app skeleton based on the db config
PHP
15
star
31

cakephp-documentation

Deprecated: An incomplete re-implementation of the CakePHP documentation as a series of tutorials. CakePHP 1.3 ONLY. Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
15
star
32

cakephp-gzip

CakePHP2: Unmaintained component that auto-gzips html output
PHP
14
star
33

cakephp-calendar-helper

Deprecated: helper that can turn a list of events into a nice, tableized calendar
PHP
13
star
34

python-gitlab-backup

backup a gitlab user or organization
Python
13
star
35

cakephp-simple-scope

CakePHP2: Deprecated behavior that adds a simple interface for scoping finds
PHP
13
star
36

cakephp-dynamic-route

CakePHP2: database-backed dynamic routes
PHP
12
star
37

cakephp-mail-preview

Deprecated CakePHP3: preview emails during development
PHP
12
star
38

cakephp-sitemap

Deprecated: a simple helper that will help you build xml sitemaps and sitemap indexes
PHP
12
star
39

go-brew-manage

Tool for managing a homebrew installation
Makefile
11
star
40

cakephp-log

CakePHP2: logable behavior packaged as a standalone plugin
PHP
11
star
41

cakephp-supervalidatable

Deprecated: packaging delicious validation rules into one behavior :)
PHP
11
star
42

cakephp-twilio

Deprecated: Twilio datasource with support for the major Model methods
PHP
10
star
43

cakeadvent-2016

A repository holding all the code for CakeAdvent 2016
PHP
10
star
44

chef-solo-cup

python wrapper around chef-solo, for managing AWS instances
Python
10
star
45

cakephp-bookmark

CakePHP2: Unmaintained helper that creates links to popular bookmarking web-applications
PHP
9
star
46

chef-cookbooks

A set of generic cookbooks for chef
Ruby
9
star
47

cakephp-blueprint-helper

Deprecated: blueprintcss helper that facilitates some of the oft-repeated parts of the framework
PHP
7
star
48

sshd-config

A tool for manipulating an sshd_config file
Go
7
star
49

cakephp-settings

CakePHP2: a simple plugin to track application settings
PHP
7
star
50

app

CakePHP3: a composer project skeleton for the FUTURE
PHP
7
star
51

cakephp-keyvalue

CakePHP2: Model behavior built that allows you easily store flexible data sets by using a key/value type system.
PHP
7
star
52

cli-skeleton

An opinionated framework for building golang cli tools on top of mitchellh/cli.
Go
6
star
53

ssh-github

An ssh server with support for ssh via a github user's keys
Go
6
star
54

cakephp-fractal-entities

CakePHP3: A thin wrapper around the CakePHP View layer to bring in League\Fractal support
PHP
6
star
55

recorded-ssh

github-backed ssh authentication with automatic session recording
Python
5
star
56

cakephp-stylish-errors

Deprecated: Creates Rails-style error messages in your view (with session messages included!). Just add "echo $errors_for_layout;"
PHP
5
star
57

cakephp-package-installer

Deprecated: Install packages (plugins, applications, utilities) using this plugin
5
star
58

bash-filedb

A command line tool for manipulating a simple, flat-file database.
Shell
5
star
59

php-elastic-adium

a project aimed at allowing me to search my adium chatlogs outside of adium
PHP
5
star
60

dokku-procfile-picker

allows you to specify a procfile to use for an app deployed on dokku
Shell
5
star
61

media-manager

an opensource asset management tool built in CakePHP
PHP
4
star
62

cakephp-deleted-at

CakePHP2: Unmaintained plugin that handles soft-deletion of database records
PHP
4
star
63

cakephp-trimmable

Deprecated: behavior that creates a shorturl for the current record
PHP
4
star
64

tutorial-blog

The 3.0 blog tutorial
PHP
3
star
65

tutorial-autocomplete

jquery autocomplete tutorial for 1.3
PHP
3
star
66

service-skeleton

An opinionated framework for building golang web services
Go
3
star
67

cakephp-database-logger

Deprecated: log anything to the database
PHP
3
star
68

python-aws-hostname

Outputs a valid hostname for a given AWS instance
Python
3
star
69

rad-cakephp-2

Issue Tracker for the "Rapid Application Development with CakePHP 2" BOOK
3
star
70

cakephp-retranslatable

Deprecated: Stop worrying about populating your translation data AFTER you have your app built and database populated
PHP
3
star
71

bash-hipchat

Send hipchat notifications from the command line
Shell
3
star
72

cakephp-ajax-controller

CakePHP2: Deprecated parent controller class that adds a helper _respond() method for ajax requests
PHP
3
star
73

dokku-compose-app

Python
3
star
74

docker-python-tutorial

Python
2
star
75

java-todo-list

J2ME TodoList app for phones with CLDC-1.1 configuration and MIDP-2.1 profile
Java
2
star
76

rds-reservation-analyzer

performs naive analysis on average rds resource utilization to inform reservation decisions
Python
2
star
77

josegonzalez.github.io

My Website, made of Jekyll
HTML
2
star
78

site-humanslol

or rofl, i guess
2
star
79

cakephp-inflection-shell

Deprecated: Inflect the heck out of your word(s)
2
star
80

cakephp-serializable

Deprecated: Store serializable data within relational databases in a snap
PHP
2
star
81

python-command-notifier

A very simple command-notification package based on SQS for distributed systems
Python
1
star
82

doc-theme

A doc theme
CSS
1
star
83

site-didmarkbreakthebuild.com

1
star
84

go-avahi-register

A tool for registering services against avahi/bonjour
Go
1
star
85

cakephp-users

A simple wrapper for various projects to make crud and user management a breeze
PHP
1
star
86

ruby-mendeleev

a periodic table of elements
Ruby
1
star
87

josediazgonzalez.com

The jekyll-backed source code for my blog
HTML
1
star
88

python-dns-api

A simple service for managing a dnsimple account.
Python
1
star
89

cakephp-codebasehq

Deprecated: Shell than can calculate CodeBaseHQ time using git commit messages
1
star
90

python-smooshy

Deprecated: Python binary to losslessly compress images using smush.it
Python
1
star
91

chefsen

chef based os x management system
Ruby
1
star
92

go-xunit-reader

A tool for reading xunit xml output files
Makefile
1
star
93

docker-travis-php

python-based .travis.yml parser that poops out a simple dockerfile for php projects
Python
1
star
94

sm

Simple secret management tool for server configuration
Go
1
star