deploy/mirror-to-github

25 lines
510 B
Bash
Executable File

#!/usr/local/bin/bash
# $1 = source repository
# $2 = destination repository, including tokens
# $3 = temp dir
echo "[[ Deploy ]] mirror-to-github: $1 $2 $3"
while [ -e "$3" ]
do
echo "[[ Deploy ]] Waiting for another process to finish deploying..."
sleep 3
done
echo "[[ Deploy ]] Bare cloning repository at '$1' into '$3'"
git clone --bare "$1" "$3"
echo "[[ Deploy ]] Mirroring repo at '$3' with '$2'"
cd "$3" || exit
git push --mirror "$2"
echo "[[ Deploy ]] Deleting '$3'"
rm -rf "$3"