Skip to content

Instantly share code, notes, and snippets.

@jhorlima
Created April 25, 2020 15:32
Show Gist options
  • Save jhorlima/bcdd87b3097d777dfcebefa73f73d6ee to your computer and use it in GitHub Desktop.
Save jhorlima/bcdd87b3097d777dfcebefa73f73d6ee to your computer and use it in GitHub Desktop.
#!/bin/bash
REPO_NAME=flutter
ORIGIN_URL=https://github.com/flutter/flutter.git
REPO1_URL=https://gitlab.com/flutter/flutter.git
rm -rf $REPO_NAME
git clone --bare $ORIGIN_URL $REPO_NAME
if [ "$?" != "0" ]; then
echo "ERROR: failed clone of $ORIGIN_URL"
exit 1
fi
cd $REPO_NAME
git remote add --mirror=fetch repo1 $REPO1_URL
if [ "$?" != "0" ]; then
echo "ERROR: failed add remote of $REPO1_URL"
exit 1
fi
git fetch origin --tags
if [ "$?" != "0" ]; then
echo "ERROR: failed fetch from $ORIGIN_URL"
exit 1
fi
git fetch repo1 --tags
if [ "$?" != "0" ]; then
echo "ERROR: failed fetch from $REPO1_URL"
exit 1
fi
git push origin --all
if [ "$?" != "0" ]; then
echo "ERROR: failed push to $ORIGIN_URL"
exit 1
fi
git push origin --tags
if [ "$?" != "0" ]; then
echo "ERROR: failed push tags to $ORIGIN_URL"
exit 1
fi
git push repo1 --all
if [ "$?" != "0" ]; then
echo "ERROR: failed push to $REPO1_URL"
exit 1
fi
git push repo1 --tags
if [ "$?" != "0" ]; then
echo "ERROR: failed push tags to $REPO1_URL"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment