Created
February 17, 2013 18:55
-
-
Save noqqe/4972784 to your computer and use it in GitHub Desktop.
Simple bash version of a gitolite slave.
This file contains hidden or 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 | |
| MASTER="git@example.com" | |
| BASEDIR="/data/gitslave/" | |
| for repo in $(ssh $MASTER | grep '^ R' | awk '{print $3}') ; do | |
| if [ -d $BASEDIR/$repo ]; then | |
| cd $BASEDIR/$repo | |
| for rbranch in $(git branch -a | grep -v '^*\ master\|HEAD\ -' | awk -F/ '{print $3}'); do | |
| git checkout $rbranch | |
| git pull origin $rbranch | |
| done | |
| cd - &>/dev/null | |
| else | |
| git clone $MASTER:$repo $BASEDIR/$repo | |
| fi | |
| done &>/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment