Skip to content

gcstang/GitHub-to-B2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GitHub to Backblaze B2

Script to backup GitHub repo(s) to Backblaze B2.

This is the process:

  • Download the specified repo to a temporary directory.
  • Compress the repo using tar/gzip
  • Upload the compressed archive.
  • Delete the archive and repo from the temp dir.
  • Repeat above steps for any additional specified repos.
  • Delete the temp dir itself (if empty).

Story

I wanted to apply safer shell practices to this gist which was featured in this blog entry by Backblaze. Work started as a fork of the gist here but I wanted to support backing up multiple repositories at a time. So I decided to make a full project so I could use features from the BASH3 Boilerplate.

Changes / Improvements

  • All variables can be passed as arguments.
  • All variables are quoted for safety.
  • Exit on any error, not just the specified tests.
  • Clone the GitHub repo(s) using either HTTPS or SSH.
  • Support backing up multiple repos.
  • Authorize the B2 command line tool instead of relying on the user doing so manually.
  • Recognize the B2 command line tool from the Arch Linux user repository.
    • (It's named backblaze-b2 instead of b2 see PKGBUILD for details)
  • Removed optional file encryption section from source gist.
    • It wouldn't work as expected as it would encrypt the repo but then upload the non-encrypted copy instead.
    • If encryption was going to be used, I would not recommend using a symmetric cipher.

Credit

Nilay Patel, for git-backup-to-Backblaze-B2.sh which this script is based on. https://gist.github.com/nilayp/a2719ca5695c1d5a56c556e89207577d

About

Backup GitHub repo(s) to Backblaze B2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%