• Stars
    star
    359
  • Rank 118,537 (Top 3 %)
  • Language
    Python
  • License
    Creative Commons ...
  • Created over 14 years ago
  • Updated 5 months ago

Reviews

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

Repository Details

Backup all the repositories of a github user or organization automatically.

GitHub-Backup

Description

GitHub-Backup makes a local backup copy of all of a github user's (or github organization's) repositories.

Dependencies

GitHub-Backup requires the PyGitHub Python package for the GitHub API v3.

Installation is simple with

pip install git+https://github.com/clockfort/GitHub-Backup

Usage

usage: github-backup.py [-h] [-v {all,public,private}] [-a {owner,collaborator,organization_member}] [-d] [-q] [-m] [-f] [--skip-repos] [-g ARGS [ARGS ...]] [-t {git,http,ssh}] [-s SUFFIX] [-u USER] [-p [PASSWORD]]
                        [-P PREFIX] [-o ORG] [-A] [--all] [--starred] [--watched] [--followers] [--following] [--issues] [--issue-comments] [--issue-events] [--pulls] [--pull-comments] [--pull-commits] [--keys]
                        [--wikis] [--gists] [--starred-gists] [--releases] [--assets]
                        login_or_token backupdir

makes a backup of a github user's account

positional arguments:
  login_or_token        A Github username or token for authenticating
  backupdir             The folder where you want your backups to go

optional arguments:
  -h, --help            show this help message and exit
  -v {all,public,private}, --visibility {all,public,private}
                        Filter repos by their visibility
  -a {owner,collaborator,organization_member}, --affiliation {owner,collaborator,organization_member}
                        Filter repos by their affiliation
  -d, --debug           Show debug info
  -q, --quiet           Only show errors
  -m, --mirror          Create a bare mirror
  -f, --skip-forks      Skip forks
  --skip-repos          Skip backing up repositories
  -g ARGS [ARGS ...], --git ARGS [ARGS ...]
                        Pass extra arguments to git
  -t {git,http,ssh}, --type {git,http,ssh}
                        Select the protocol for cloning
  -s SUFFIX, --suffix SUFFIX
                        Add suffix to repository directory names
  -u USER, --username USER
                        Backup USER account
  -p [PASSWORD], --password [PASSWORD]
                        Authenticate with Github API (give no argument to check ~/.github-backup.conf or prompt for a password)
  -P PREFIX, --prefix PREFIX
                        Add prefix to repository directory names
  -o ORG, --organization ORG
                        Backup Organizational repositories
  -A, --account         Backup account data
  --all                 include everything in backup (not including [*])
  --starred             include JSON output of 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
  --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
  --keys                include ssh keys in backup
  --wikis               include wiki clone in backup
  --gists               include gists in backup [*]
  --starred-gists       include starred gists in backup [*]
  --releases            include release information, not including assets or binaries
  --assets              include assets alongside release information; only applies if including releases

Then, put it in a cron job somewhere and forget about it for eternity.

How-to back up entire GitHub organisation repos

  1. Install Dependencies: sudo pip install pygithub3
  2. Clone this repo using $ git clone https://github.com/clockfort/GitHub-Backup.git
  3. Just open the cloned repo folder and run the terminal:
./github-backup.py [Organization Name] [Path To Saving Directory] -o [Organization Name]

Example:

github-backup LineageOS /home/mohamed786/githubbak -o LineageOS

Use a personal access token (PAT) instead of your password

You can generate a dedicated personal access token instead of using your GitHub password.

Follow the steps described here in the GitHub documentation and use the token instead of your password. Using a PAT can also work around issues when two factor authentication (TFA) is enabled on your account.

Why this software exists

This software is useful in many cases:

  • GitHub suddenly explodes.
  • GitHub goes out of business.
  • Your corporation's backup policies are more stringent than GitHub's.
  • You have spotty/no internet access - perhaps you'd like to have all of your repositories available to code on while you ride the train?
  • You are paranoid tinfoil-hat wearer who needs to back up everything in triplicate on a variety of outdated tape media.

Questions, Improvements, Etc

If you have any improvements, I'm happy, (grateful, in fact) to entertain pull requests/patches, just drop me a line or message me on GitHub.

Contributors

Idea/original implementation by

More Repositories

1

wifi-locator

Determines physical location of station judging from 802.11 beacons' BSSID/Signal/Noise/Quality information.
C
33
star
2

amd-app-sdk-fixes

Patches against AMD APP SDK for newer GCC builds (I run GCC 4.7 series)
Objective-C
25
star
3

wall-of-sheep

A quick implentation of a public shaming device from hacker conventions.
Perl
23
star
4

sun-7-keyboard-layout

Use your Sun Microsystems Type 7 Keyboard in Microsoft Windows (Properly, with lettered alt graph mappings and even a supplemental mathematics entry mode)
22
star
5

rip-dvd

Dead simple rip (encrypted) DVD to ISO. Just needs mplayer and pv.
Shell
10
star
6

rr62x

Kernel module for the Rocket Raid 620, including a few changes for 3.0 and 4.0 series kernel compatibility
C
8
star
7

sysstatgraph

Pretty web-facing semi-interactive graph of sysstat data; take a look at the website listed below for an active example.
JavaScript
6
star
8

turntable-as-a-service

Robot that sits in a turntable.fm group all the time, so that users can just connect and magically use the CSH Usercenter speakers. Firefox/Flash were definitely meant to be used as a backend service, right?
Shell
6
star
9

roomba

Arduino Interface to Roomba robots
C++
5
star
10

captcha-solver

Captcha solver I mucked about with a while back. Never did get it to work perfectly, but I got enough to prod Bob to improve upon it / learn more I hope.
Ruby
5
star
11

security-stuff

A collection of harder-to-find computer security tools. Some written by me, some not.
Perl
4
star
12

raspberry-fedora

Infrastructure for building higher-performance (yes, hardware float, among other things) Fedora on Raspberry Pi hardware.
Python
4
star
13

btr-backup

Personal backup scripts (using rsync & btrfs snapshotting)
Shell
4
star
14

vbox-save

VirtualBox is a powerful free machine virtualization application, but lacks some functionality useful for forensic analysis of guest virtual machines. The objective of this application is to add easily accessible and useable memory and disk dumps of live systems. Live system imaging is an increasingly important part of computer forensic investigation, as it offers the investigator access to temporary information not written to the hard disk that would be lost if the machine were just turned off and examined.
Python
4
star
15

parallax-rfid-reader

Arduino project that uses the parallax rfid reader that Radio Shack is throwing out the doors for $10
Java
3
star
16

ClockyOS

Simple, hobby bootloader/OS kernel.
C
3
star
17

AVR-Thermistor

AVR code to get temperature readings out of a thermistor
C
3
star
18

mobile-profiles

Haskell-language LDAP browser + mobile web frontend for contact information database
Haskell
3
star
19

crossbuild-mock-plugin

Add cross-compile capabilities to mock
Python
2
star
20

datacomm-modernized-class-examples

Updated the professor's example code/assignments to work on modern GCC
C++
2
star
21

CSH-Achievements-Browser

My changes to the beautiful web interface that arthiel made for my CSH achievements-system brainchild
PHP
2
star
22

sizeBucket

Sort an initial tier of files into a symlink tree of approximately equal-sized buckets. Very functional python, would be easy to thread if you want a quick speedup. The code wouldn't look as nice though.
Python
2
star
23

csh-interactive-fiction

Interactive Fiction game about CSH made for a game-jam competition. Winner of "Most Obscure Language" and "Most Tactical" awards. Written in Inform7.
2
star
24

Camp

Super-unusuable-alpha of a Haskell distributed version control project. Camp is not my project, I have just made some changes to it to make it more usable, while the main devs spend all day working on formal proofs of various aspects of the project. (Which are important, but I just want to use this now :-) )
Haskell
2
star
25

rss-makers

A collection of random RSS-making scripts
1
star
26

csh-repo-rpm

1
star
27

LED-Candle

Yet another digital flickering candle solution, this one for AVR chips. It looks pretty good/realistic though, and I'll be adding cooler features later.
C
1
star
28

barbie-car

Onboard electronics/sensors for CSH's electric vehicle
Arduino
1
star
29

bingehack-website

Introductory website to BingeHack.
JavaScript
1
star
30

pcjr_3d_demo

A working 3D rendering engine demo for the IBM PCJr (currently just a spinning 3D cube). Apologies for the pre-C89 code, it's difficult to get good modern compilers/libraries for compiling for 286 chips.
C
1
star
31

dynamicmon

Keep an eye out for rogue users and other problems on Computer Science House's network
Perl
1
star
32

lenovo-X230T-parts

3D-printable CAD file replacement parts for my X230T, which has a tendency to explosively shed small plastic parts. Some parts should be compatible with X220T series.
1
star
33

iui

Clone of the iUI project, but with a few directory moves and minor changes by me for my projects.
JavaScript
1
star
34

radio-test

quickly-written test code to test functionality of some cheap chinese radio chipsets
C
1
star
35

bling

Internal CSH Search Engine
Haskell
1
star
36

web-comic-ebook-export

Take in a list of GET requests (i.e. debug data dump from firefox) and use it to re-order and CBZ-collate image files
Haskell
1
star
37

ArduinoSharpIRSensor

C++
1
star
38

test-btrfs-convert

Testing script for some improvements to btrfs-progs
Shell
1
star
39

Life

Memory-efficient version of Conway's Game of Life (for later inclusion in a microcontroller project)
C++
1
star
40

trivia-bot

Solves multiple-answer trivia questions. Will be in RIT's ImagineRIT innovation fair, where visitors can test their wits against the machines.
Perl
1
star
41

beatnik-helper

A tool to aid programming in Beatnik (http://esolangs.org/wiki/Beatnik)
Perl
1
star
42

matrix-led-arduino

LED-Matrix controlling code for an unknown, unlabelled, very cheap ebay'd matrix array.
Java
1
star
43

universal-gcode-sender-contour-jog-control

You may want to create a copy of javaw with a different name so you can have more unique settings for other java applications
1
star
44

achieve-rest

RESTful haskell web server for achievements database
Haskell
1
star
45

python-pyudev-rpm

RPM build (Fedora/EPEL/RHEL focused) of python-pyudev.
1
star
46

Simple-Shell

A rather simple shell written in C; good as an illustrative example on basic syscalls or the like.
C
1
star
47

girlsName

A Haskell-backed webpage/API backed by a time-based uniform-distribution hash algorithm to map input to census data. ... all to make fun of Michael Dumont.
Haskell
1
star
48

euler-problems

Some of the Project Euler problems I have written, with an emphasis on brevity and beauty while maintaining an appropriate run time. Started these to learn Haskell; my Haskillz have improved twenty-fold in the more recently solved problems :-) I've also added hardware-synthesizable VHDL code for problem #1, just because.
Haskell
1
star
49

brewtools

A set of tools helpful to brewing your own beverages. Most all of the utilities apply to making beer, but several are generic enough to apply to making your own wine, soda, cider, etc.
Perl
1
star
50

backports

Packages for EL6/F17 that I required newer versions of and/or newer versions + new features compiled in
1
star
51

firewall-access

Web interface allowing users to temporary open holes in the firewall to use non-public printers. Deprecated by CSH wireless deployment of 2011, so it never saw any use, and as a result it remains a sad 98% complete (needs input validation before deployment)
Perl
1
star
52

image-resequencer

None of the movie maker apps I tried (ffmpeg, Quicktime, VirtualDub) work well with ISO8601 datestamps :-/ But they are convenient to use and meaningful... so this script converts them just so I can re-arrange them into animations. Also was an opportunity to play with PowerShell.
PowerShell
1
star
53

dalek

I wrote this a few years ago, when I was much worse at programming. It's a good look at how to interact with the serial port in java though (in a cross-platform way), so I plopped it here so that a friend could take a look at the serial code. I ended up implementing this entire project as a tiny bit of extra code on top of a LUFA AVR USB joystick module.
Java
1
star