#!/bin/bash # # This script copies the contents of a directory to the git master # of a given repository. It thus can abuse Git for revisioned # backups. Sweet! # 2021, Public Domain, SvenK backup_directory="assets" git_work_directory="assets-git" # these are secrets: user="" pass="" remote="https://$user:$pass@githost/the/path.git" set -e rm -rf $git_work_directory git clone --depth=1 $remote $git_work_directory cp $backup_directory/* $git_work_directory cd $git_work_directory git add . git commit -m"New backup carried out on $(hostname) by $(whoami) at local $(date)." git push cd ..