Skip to content

obfusk/ghbak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

File        : README.md
Maintainer  : Felix C. Stegerman <flx@obfusk.net>
Date        : 2020-06-22

Copyright   : Copyright (C) 2020  Felix C. Stegerman
Version     : v0.1.5
License     : GPLv3+

PyPI Version CI GPLv3+

Description

ghbak - github backup

Mirror (or update) github repos (and issues) and/or gists to:

{basedir}/
  {github_username}/
    github/
      {repo_name}.git
      {repo_name}-issues.json
      ...
    gist/
      {gist_id}.git
      ...

The base directory defaults to ./{YYYYMMDD} (the current date).

Examples

$ export GITHUB_TOKEN=your-github-token
$ ghbak --repos --gists --ssh --verbose your-github-username
user: your-github-username
token $GITHUB_TOKEN
GET https://api.github.com/users/your-github-username/repos
...
GET https://api.github.com/users/your-github-username/gists
...
cloning 42 repos...
==> repo your-github-username/your-repo | description
$ cd 20200101/your-github-username/github
$ git clone --mirror -n git@github.com:your-github-username/your-repo.git your-repo.git
...
cloning 37 gists...
==> gist your-github-username | gist-id | description
$ cd 20200101/your-github-username/gist
$ git clone --mirror -n git@gist.github.com:gist-id.git gist-id.git
...

=== summary ===

backed up repos: 42
backed up gists: 37

Help

$ ghbak --help

Requirements

Python >= 3.5 + click + requests.

Installing

Using pip

$ pip install ghbak

Manually

Install the dependencies (as e.g. debian packages or using pip):

$ apt install python3-click python3-requests  # debian/ubuntu
$ pip install click requests                  # pip

Then just put ghbak somewhere on your $PATH (e.g. ~/bin).

License

GPLv3+