github gitlab repository mirroring
The snippet can be accessed without any authentication.
Authored by
Claudio Pisa
A script to mirror a github repository into a gitlab repository (one way). The user running the script should be enabled to write to the repository through SSH.
#!/bin/bash
REPONAME=$1
SRCURL=$2
DSTURL=$3
if [ -z "$DSTURL" ]; then
echo "Usage: $0 <repository name> <github URL> <gitlab SSH URL>"
exit 1
fi
REPODIR=/home/gitlabmirror/repos/${REPONAME}.git
rm -rf $REPODIR
/usr/bin/git clone --bare $SRCURL $REPODIR
/usr/bin/git -C $REPODIR remote add gitlab $DSTURL
/usr/bin/git -C $REPODIR push --mirror gitlab
Please register or sign in to comment