From f59ed3a176a865032e0f7cfaa549d19ddeeb4deb Mon Sep 17 00:00:00 2001 From: "Miguel (Comet)" Date: Thu, 8 Apr 2021 20:59:42 +0200 Subject: added admin stuff --- git_backup/git_backup.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 git_backup/git_backup.sh (limited to 'git_backup') diff --git a/git_backup/git_backup.sh b/git_backup/git_backup.sh new file mode 100644 index 0000000..5082b9b --- /dev/null +++ b/git_backup/git_backup.sh @@ -0,0 +1,15 @@ +# 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 + +echo BACKING UP REFS etc ... +rsync -av --delete --exclude "*/objects" $INPUT $OUTPUT +echo BACKING UP OBJECTS AFTER REFS +rsync -av --delete --include "*/" --include "*/objects/**" --exclude "*" $INPUT $OUTPUT +#rsync -av --delete --include '/*/objects' --include "/*" --exclude '/*/*' $INPUT $OUTPUT +#rsync -av --delete --include '/*/objects/*' --exclude '/*/*/*' $INPUT $OUTPUT + -- cgit v1.2.3