repo-backup

Crates.iorepo-backup
lib.rsrepo-backup
version0.2.2
sourcesrc
created_at2017-12-16 19:39:05.325723
updated_at2018-10-20 14:54:58.621189
descriptionA program for backing up your GitHub and GitLab repos.
homepage
repositoryhttps://github.com/Michael-F-Bryan/repo-backup
max_upload_size
id43320
size47,450
rust-devs (github:intility:rust-devs)

documentation

https://docs.rs/repo-backup

README

Repo Backup

Build Status Build status Crates.io Docs License

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
  • owned
  • starred
GitLab
  • owned
  • repositories belonging to organisations you are a part of

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 an api-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.

Commit count: 81

cargo fmt