glb
backs up Github repositories to your local filesystem.
glb
can be installed via npm
:
[sudo] npm install [-g] github-local-backup
After installing, a glb
executable will reside on your PATH
.
glb
requires that git
be installed on your system PATH
. In order to
minimize configuration, glb
works by simply defering to git
on the shell.
glb
accepts a list of newline-delimited URLs on stdin
and downloads the
specified repositories to <target-dir>
.
# repos.txt contains a list of repository URLs
user@host:~$ cat ~/desktop/repos.txt
[email protected]:john-doe/alpha.git
[email protected]:john-doe/bravo.git
[email protected]:jane-doe/charlie.git
# pipe repos.txt into stdin
user@host:~$ cat ~/desktop/repos.txt | glb download ~/src/github-backup
Repositories will be grouped by username to prevent namespace conflicts:
user@host:~$ tree ~/src/github-backup
github-backup
├── john-doe
│ ├── alpha
│ ├── bravo
└── jane-doe
└── charlie
Repositories that are absent from <target-dir>
will be downloaded locally via
git clone
. Repositories that are present in <target-dir>
will be updated
via git pull --all
.
If provided with a Github Personal API token, glb
can generate a
list of all repositories to which a given account has access:
user@host:~$ glb discover $TOKEN
[email protected]:john-doe/alpha.git
[email protected]:john-doe/bravo.git
[email protected]:jane-doe/charlie.git
glb discover
and glb download
may be chained to back up all of your Github
repositories:
user@host:~$ glb discover $TOKEN | glb download ~/src/github-backup