summaryrefslogtreecommitdiffstats
path: root/gitolite-mirror.sh
blob: 8dfc85785a8fe1f4f1628db4923d161c3933f1cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#! /bin/bash

if [ $# -lt 1 ]; then
    echo "missing gitolite config file"
    exit 1
fi

RESET="\033[0m"
GREEN="\033[0;32m"

GIT_URI=${GIT_URI:-"git://asynk.ch"}
GITOLITE_CONF=$1

cat $GITOLITE_CONF | grep '^repo' | sed 's/repo\s\+//' | while read repo; do
    echo -e "** >$GREEN$repo$RESET<"
    if [ -d "${repo}" ]; then
        cd $repo
        git remote update --prune
        cd ..
    else
        git clone --mirror $GIT_URI/${repo}.git $repo
    fi
done