Datestamped backup of git repositories managed by gitosis

Published: 2011-08-19 by Pradeep Gowda.
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