Datestamped backup of git repositories managed by gitosis

Created: by Pradeep Gowda Updated: May 22, 2020 Tagged: git

This is a neat little demonstration of the power of the UNIX pipes.


A script to backup all the git repositories managed by gitosis
and create a date stamped tarball.

Pradeep Gowda

TODAY=`date +%Y-%m-%d`

mkdir gitbackups-$TODAY
grep ^writable $GITOSISADMIN/gitosis.conf | cut -d= -f 2 | tr "\\n" " " | tr " " "\\n"  | sort  | uniq | xargs -I {} git clone $GITSERVER:{}.git gitbackups/{}
tar czf gitbackups-$TODAY.tgz gitbackups

Updates on