3 releases
Uses old Rust 2015
0.2.2 | Oct 20, 2018 |
---|---|
0.2.1 | Dec 21, 2017 |
0.2.0 | Dec 16, 2017 |
#1812 in Development tools
41KB
837 lines
Repo Backup
A small utility for making a local copy of all your projects from a variety of various sources.
Sources currently supported:
Provider | Available Repositories |
---|---|
GitHub |
|
GitLab |
|
Getting Started
If you already have Rust installed, you can install the program directly from crates.io:
$ cargo install repo-backup
Otherwise, pre-compiled binaries are available from GitHub Releases.
Once you have installed repo-backup
, you can run it from the command line.
$ repo-backup -v
2017-12-17 02:01:42 [INFO ]: Starting repository backup
2017-12-17 02:01:42 [INFO ]: Fetching repositories from github
2017-12-17 02:01:49 [INFO ]: Found 209 repos from github
2017-12-17 02:01:49 [INFO ]: Updating repositories
2017-12-17 02:05:46 [INFO ]: Finished repository backup
This tool is designed to avoid superfluous output and only print messages to
the terminal when there is an issue (sometimes known as "the rule of silence"
in the Unix Philosophy). However, you can tell it to be more verbose by
adding consecutively more -v
flags.
The generated tree structure looks something like this (with a couple hundred directories elided for conciseness):
$ tree -L 3 /srv/
/srv/
├── github
│ ├── BurntSushi
│ │ └── ripgrep
...
│ ├── Michael-F-Bryan
│ │ ├── rust-ffi-guide
...
│ │ └── repo-backup
...
│ └── yupferris
│ └── rustendo64
└── gitlab
├── Curtin-Motorsport-Team
│ ├── CAN-node
...
│ └── telemetry
└── Michael-F-Bryan
├── dotfiles
...
└── uni-work
Configuration
Configuration is done via a repo-backup.toml
file. By default the
repo-backup
program will look for this in your home directory (as
~/.repo-backup.toml
), but this can be overridden via the command line.
The only required table is general
, with the others used to enable and
configure the corresponding Provider
.
Hint: You can ask the tool to print an example config using the
--example-config
flag.$ repo-backup --example-config [general] dest-dir = '/srv' [github] api-key = 'your API key' starred = false owned = true [gitlab] api-key = 'your API key' url = 'https://gitlab.com/' organisations = true owned = true
In general, all
Provider
specific keys are optional, with the exception of anapi-key
.
Most providers will require you to have an API key in order to access their API and retrieve a full list of backup targets.
For the GitHub provider You will need to create a new personal access token and give it the public_repo permissions before you can fetch repos. The GitLab provider also requires you to create a personal access token and give it the "api" scope.
Dependencies
~28–40MB
~711K SLoC