Announcing repo-backup


#1

Repo-backup is, surprise surprise, a program for backing up your repositories. It’s just a small program which lets you download a local version of all the repositories on GitHub or GitLab you own or have expressed interest in.

This started off as a side project to help me keep an updated version of several repositories I was interesting (original post). However it became quite invaluable recently when I was travelling, often having little to no internet, so I thought I’d clean it up and publish on crates.io so others can benefit too.

Pre-compiled binaries are available on GitHub Releases, otherwise if you have the Rust compiler installed you can run cargo install repo-backup.

I’ve added the following line to my crontab so it’ll be run every night at 1am:

0 1 * * * /home/michael/.cargo/bin/repo-backup

#2

But… why do you need to backup your repo? Isn’t that the reason why we have version control?


#3

Yeah, most definitely! And about 30% of my public GitHub repositories are in my ~/Documents directory, scattered about the place. This was more about getting a local copy of all the repositories I’ve starred so I can still look through them and use them when offline (e.g. on the plane or when I’m away from civilisation for a while).

The particular event which made me realise how useful it is to have access to all starred and owned repositories was recently when I went to the other side of the country for a competition. Over there the only internet access we had was through mobile data, and when your provider only gives you 2GB of downloads a month it doesn’t tend to last very long.

By having this set of local copies we still had access to all the private repositories our team’s GitHub organisation owned or used. It actually saved our bacon a couple times when we went to the middle of nowhere (with no cell reception) for testing, only to find out one of the devices had a firmware issue which we needed to fix right away or risk wasting an entire day of testing.

I didn’t happen to own (or even be involved in) the repository in question, yet because I’d starred it ages ago I still had an up-to-date copy people could use.