Files
github2gitlab/mirror.sh

21 lines
879 B
Bash
Executable File

#!/bin/bash
# cribbed from https://forum.gitlab.com/t/mirror-dropdown-change-from-push-to-pull-not-working/34162/6
REPO_HOME="./sync"
declare -A REPOS
# syntax is [github_repo]="gitlab_repo"
REPOS=([sheumann/AFPBridge]="salfter/AFPBridge"
[sheumann/smbfst]="salfter/smbfst"
[bl0x/learn-fpga-amaranth]="salfter/learn-fpga-amaranth"
[BrunoLevy/learn-fpga]="salfter/learn-fpga"
[tinyfpga/TinyFPGA-BX]="salfter/TinyFPGA-BX")
cd $REPO_HOME
for REPO_GITHUB in "${!REPOS[@]}"
do
REPO_LOCAL=${REPOS[$REPO_GITHUB]}
echo "### Processing repo $REPO_LOCAL"
if [ ! -d $REPO_LOCAL ]; then
git clone --bare --mirror https://github.com/$REPO_GITHUB.git $REPO_LOCAL
fi
(cd $REPO_LOCAL; git fetch --prune; git push ssh://git@gitlab.alfter.us:222/$REPO_LOCAL.git +refs/heads/*:refs/heads/* +refs/tags/*:refs/tags/*)
done