All Projects → qvl → Ghbackup

qvl / Ghbackup

Licence: mit
Embarrassingly simple GitHub backup tool

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Ghbackup

Butler
Export/Import Jenkins jobs & plugins 📤
Stars: ✭ 113 (-18.71%)
Mutual labels:  cli, backup
Node Firestore Backup
Google Firebase Firestore backup tool
Stars: ✭ 192 (+38.13%)
Mutual labels:  cli, backup
Grafcli
Grafana CLI for quick and easy dashboards management.
Stars: ✭ 152 (+9.35%)
Mutual labels:  cli, backup
S3cmd
Official s3cmd repo -- Command line tool for managing Amazon S3 and CloudFront services
Stars: ✭ 3,767 (+2610.07%)
Mutual labels:  cli, backup
Mt Aws Glacier
Perl Multithreaded Multipart sync to Amazon Glacier
Stars: ✭ 522 (+275.54%)
Mutual labels:  cli, backup
Telegram backup
Java app to download all your telegram data.
Stars: ✭ 409 (+194.24%)
Mutual labels:  cli, backup
Ludusavi
Backup tool for PC game saves
Stars: ✭ 301 (+116.55%)
Mutual labels:  cli, backup
Mongodb Backup Cli
mongodb-backup cli for Nodejs
Stars: ✭ 17 (-87.77%)
Mutual labels:  cli, backup
Dynein
DynamoDB CLI written in Rust.
Stars: ✭ 126 (-9.35%)
Mutual labels:  cli, backup
Git Tidy
Tidy up stale git branches.
Stars: ✭ 137 (-1.44%)
Mutual labels:  cli
Cli
share secrets within teams to avoid plain-text secrets from day one
Stars: ✭ 138 (-0.72%)
Mutual labels:  cli
Mysqldump
Node Module to Create a Backup from MySQL
Stars: ✭ 136 (-2.16%)
Mutual labels:  backup
Site Scan
CLI for capturing website screenshots, powered by puppeteer.
Stars: ✭ 137 (-1.44%)
Mutual labels:  cli
Cargo Edit
A utility for managing cargo dependencies from the command line.
Stars: ✭ 2,095 (+1407.19%)
Mutual labels:  cli
Braincup
Train your math skills, memory and focus.
Stars: ✭ 137 (-1.44%)
Mutual labels:  cli
Climake
The simplistic, dependency-free cli library ✨
Stars: ✭ 139 (+0%)
Mutual labels:  cli
Fsarchiver
file system archiver for linux
Stars: ✭ 135 (-2.88%)
Mutual labels:  backup
Loophole
Polar devices Python API and CLI.
Stars: ✭ 136 (-2.16%)
Mutual labels:  cli
Wal G
Archival and Restoration for Postgres
Stars: ✭ 1,974 (+1320.14%)
Mutual labels:  backup
Gh
(DEPRECATED) GitHub CLI made with NodeJS
Stars: ✭ 1,701 (+1123.74%)
Mutual labels:  cli

💾 ghbackup

GoDoc Build Status Go Report Card

Backup your GitHub repositories with a simple command-line application written in Go.

The simplest way to keep your repositories save:

  1. Install ghbackup
  2. Get a token from https://github.com/settings/tokens
  3. ghbackup -secret token /path/to/backup/dir

This will backup all repositories you have access to.


Embarrassing simple GitHub backup tool

Usage: ghbackup [flags] directory

  directory  path to save the repositories to

At least one of -account or -secret must be specified.

Flags:
  -account string
        GitHub user or organization name to get repositories from.
        If not specified, all repositories the authenticated user has access to
will be loaded.
  -secret string
        Authentication secret for GitHub API.
        Can use the users password or a personal access token (https://github.c
om/settings/tokens).
        Authentication increases rate limiting (https://developer.github.com/v3
/#rate-limiting) and enables backup of private repositories.
  -silent
        Suppress all output
  -version
        Print binary version

For more visit https://qvl.io/ghbackup.

Install

  • Note that ghbackup uses git under the hood. Please make sure it is installed on your system.

  • With Go:

go get qvl.io/ghbackup
brew install qvl/tap/ghbackup

Automation

Mostly, we like to setup backups to run automatically in an interval.

Let's setup ghbackup on a Linux server and make it run daily at 1am. This works similar on other platforms. There are different tools to do this:

systemd and sleepto

Also see this tutorial.

systemd runs on most Linux systems and using sleepto it's easy to create a service to schedule a backup.

  • Create a new unit file:
sudo touch /etc/systemd/system/ghbackup.service && sudo chmod 644 $_
  • Edit file:
[Unit]
Description=GitHub backup
After=network.target

[Service]
User=jorin
ExecStart=/PATH/TO/sleepto -hour 1 /PATH/TO/ghbackup -account qvl /home/USER/github
Restart=always

[Install]
WantedBy=multi-user.target
  • Replace the paths with your options.

  • Start service and enable it on boot:

sudo systemctl daemon-reload
sudo systemctl enable --now ghbackup
  • Check if service is running:
systemctl status ghbackup

Cron

Cron is a job scheduler that already runs on most Unix systems.

  • Run crontab -e
  • Add a new line and replace NAME and DIR with your options:
0 1 * * * ghbackup -account NAME DIR

For example:

0 1 * * * ghbackup -account qvl /home/qvl/backup-qvl

Sending statistics

The last line of the output contains a summary. You can use this to collect statistics about your backups. An easy way would be to use a Slack hook and send it like this:

ghbackup -secret $GITHUB_TOKEN $DIR \
  | tail -n1 \
  | xargs -I%% curl -s -X POST --data-urlencode 'payload={"text": "%%"}' $SLACK_HOOK

What happens?

Get all repositories of a GitHub account. Save them to a folder. Update already cloned repositories.

Best served as a scheduled job to keep your backups up to date!

Limits

ghbackup is about repositories. There are other solutions if you like to backup issues and wikis.

Use as Go package

From another Go program you can directly use the ghbackup sub-package. Have a look at the GoDoc.

Development

Make sure to use gofmt and create a Pull Request.

Releasing

Push a new Git tag and GoReleaser will automatically create a release.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].