I often backup my laptop to an external hard drive. Is rsyncing git repos over good enough backup solution or are there any problems with this method?
git is not a backup system.
If your system is being actively accessed by some other systems on the network, it is not a better solution. Because, the contents of the systems might be constantly updated every minute, and some files may change during the rsync process.
You shouldn't store credentials like usernames, passwords, API keys and API secrets. If someone else steals your credentials, they can do nasty things with it.
Clone Everything in Git Repository You can backup every file in your git repository by doing the normal git clone <git-url. git> command. By doing that, you download every file in your repository with their actual size and you can do git workflow in it. It's basically the usual way to clone a git repository.
rsync
is a good solution for this. It may be a good idea to run git gc
and git repack
(neither with any arguments) before doing your backup; this may significantly reduce the number of files, and increase the chance of the data not changing too much by next time. Neither will lose any data.
See http://sethrobertson.github.com/GitBestPractices/#backups for a write-up of why doing this with git isn't such a good solution.
rsync is interesting if you really want to backup everything (including hooks and private files).
However:
A nicer (and cleaner) solution would be to use git bundle (which is essentially a bar repo seen as one file).
You update your local bundle, and save rsync it to your remote media.
Except that, this time, you only "rsync" (actually a simple copy is enough) one file.
And you can directly clone or pull from that one file, that bundle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With