Created
March 18, 2014 21:03
-
-
Save m87h/9629563 to your computer and use it in GitHub Desktop.
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 | |
if [ $# -lt 3 ]; then | |
echo "usage: mirror-git <source repo> <local cache> <destination repo>" >&2 | |
exit 1 | |
fi | |
SOURCE=$1 | |
LOCAL_CACHE=$2 | |
DESTINATION=$3 | |
if [ -d $LOCAL_CACHE ]; then | |
cd $LOCAL_CACHE | |
git remote update | |
git push --mirror $DESTINATION | |
else | |
git clone --mirror $SOURCE $LOCAL_CACHE | |
cd $LOCAL_CACHE | |
git push --mirror $DESTINATION | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment