Created
March 16, 2018 18:52
-
-
Save ConnerAiken/df03dcae1a853f8a110339e568e79995 to your computer and use it in GitHub Desktop.
Sync two git repositories
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 | |
# REPO_NAME=<repo>.git | |
# ORIGIN_URL=git@<host>:<project>/$REPO_NAME | |
# REPO1_URL=git@<host>:<project>/$REPO_NAME | |
rm -rf $REPO_NAME | |
git clone --bare $ORIGIN_URL | |
cd $REPO_NAME | |
git remote add --mirror=fetch repo1 $REPO1_URL | |
git fetch origin --tags git fetch repo1 --tags | |
git push origin --all git push origin --tags | |
git push repo1 --all git push repo1 --tags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment