Using git as a backup tool without local .git folder

2

This question should probably be posted at superuser.com, but I guess we've got some more git experts here..

What I'd like to do is to use git as a backup tool, but WITHOUT having a local .git directory with all it's contents on the working machine.

I could do it by symlinking the .git directory to the backup disk, but maybe there's a better way? Also, I'd like to use ssh instead of mounting an USB disk, so the backup disk could be somewhere else.

The reason for this, if anybody wonders, is that I want to backup my music collection from a laptop with a limited drive. Having all the files twice within the .git directory seems a bit overkill.

Dave Vogt

Posted 2009-12-31T14:38:58.823

Reputation: 1 470

1bad idea, imo. git is not for that. – Rook – 2009-12-31T15:00:19.710

1if you really need to be sure the files copied are the ones, then just take some tool and calculate the hashes with it. – Rook – 2009-12-31T15:00:51.487

Answers

2

I'd also suggest that you use a proper backup tool, such as rsync/rsnapshot (if you need the backed-up files to still be playable) or duplicity (if you don't). If you need to sync in both directions, or want to see what has changed before syncing, there's also unison, which I use to keep the music files on my Laptop in sync. Additional verification of file integrity could be done using a tool like md5deep, however you'd have to write wrapper-scripts yourself.

If you really, really want to use something git-based, you could look at gibak, which is a general-purpose backup-tool based on git. I haven't looked at it too closely though, so it might not be the right choice for you; I think you would still need to symlink the .git-directory for one.

DataWraith

Posted 2009-12-31T14:38:58.823

Reputation: 148

4

you can use rsync, which is more suited for basic mirroring than using a version control system

bigjust

Posted 2009-12-31T14:38:58.823

Reputation: 141

I'm currently using a combination of hardlinks and rsync for backup, but i'd like to have some of git's features like log, and the security of the sha1 hashes. – Dave Vogt – 2009-12-31T14:52:50.387

rsync can log ('-v).. not really sure why you need sha1 hashes to back up music between two machines, to each his own! – None – 2009-12-31T15:12:40.900

To verify that the files have transferred correctly, and there's no corruption. – Dentrasi – 2010-01-01T16:39:25.037

1

git is for versioning files. If you just want a backup try rsnapshot.

rfunduk

Posted 2009-12-31T14:38:58.823

Reputation: 131

0

Using git as a backup is a bad idea. If you want to preserve space on your laptop, perhaps consider using a bare repository and writing a wrapper around your music player that will extract the files as needed from the repository.

William Pursell

Posted 2009-12-31T14:38:58.823

Reputation: 1 387