Created
May 16, 2011 15:18
-
-
Save cnlpete/974629 to your computer and use it in GitHub Desktop.
really basic script to backup a ouple of git-repos , for instance to put in cron or rsnapshot or similar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
##host | |
githost="git@mitharas.de" | |
#---------- | |
# get list of repos using git gl-info from https://cnlpete@github.com/cnlpete/gitolite-tools.git | |
#install git ls-info | |
curdir=`pwd` | |
cd /tmp | |
#git clone https://cnlpete@github.com/cnlpete/gitolite-tools.git gitolite-tools | |
#cd gitolite-tools | |
#make && sudo make install | |
cd $curdir | |
repos=`git gl-info ${githost} | awk '/.*R.*\w+/ {print $NF}' | tr -d '\r'` | |
for line in ${repos} | |
do | |
echo ${line} | |
if [ ! -d ${line}.git ]; then | |
mkdir ${line}.git | |
git clone --mirror -q ${githost}:${line} ${line}.git > /dev/null | |
fi | |
cd ${line}.git | |
git remote update > /dev/null | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment