Created
July 27, 2020 13:59
-
-
Save cl4u2/6146a637ad77882e9b99c1d754b68e37 to your computer and use it in GitHub Desktop.
One-way mirror of a github repository into a gitlab repository
This file contains 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 | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment