# 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=~/BACKUPS/comet_git_backup/$TIMESTAMP OUTPUT_TAR=~/BACKUPS/comet_git_backup/$TIMESTAMP.tar echo TIMESTAMP = $TIMESTAMP echo INPUT = $INPUT echo OUTPUT = $OUTPUT echo OUTPUT_TAR = $OUTPUT_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 REM TEMP DIR ... rm $OUTPUT -rf echo DONE! #rsync -av --delete --include '/*/objects' --include "/*" --exclude '/*/*' $INPUT $OUTPUT #rsync -av --delete --include '/*/objects/*' --exclude '/*/*/*' $INPUT $OUTPUT