# https://git.seveas.net/how-to-back-up-a-git-repository.html #But even if you do not have the capability to do snapshots, you can still make consistent backups, as long as you back up objects after refs. You might end up with some dangling objects, but your repository will be consistent and all refs will point to existing objects. With rsync, that could look like: TIMESTAMP=$(date +%Y%m%d%H%M%S) INPUT=comet:/var/lib/gitolite/repositories OUTPUT=~/comet_git_backup/$TIMESTAMP OUTPUT_TAR=~/comet_git_backup/$TIMESTAMP.tar echo BACKING UP REFS etc ... rsync -a --delete --exclude "*/objects" $INPUT $OUTPUT echo BACKING UP OBJECTS AFTER REFS ... rsync -a --delete --include "*/" --include "*/objects/**" --exclude "*" $INPUT $OUTPUT echo TAR BACKUP ... tar -cf $OUTPUT_TAR $OUTPUT echo DONE! #rsync -av --delete --include '/*/objects' --include "/*" --exclude '/*/*' $INPUT $OUTPUT #rsync -av --delete --include '/*/objects/*' --exclude '/*/*/*' $INPUT $OUTPUT