Last active
March 14, 2018 00:12
-
-
Save MilesDowe/d10350347856f445fb412c179a682145 to your computer and use it in GitHub Desktop.
Migrate Git repos between sources
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
#Tweaked from https://blogs.s-osg.org/retain-history-moving-files-git-repositories/ | |
# Pull your new location | |
git clone <your new repo> | |
cd /path/to/new/repo | |
# Link to old location and crate a branch off it | |
git remote add old-location ssh://git@github.com/organization/repo.git # or HTTPS | |
git fetch old-location | |
# Set master to target branch | |
git checkout -b master old-location/master | |
# Push to your new location | |
git push origin master | |
# Unlink the old location | |
git remote remove old-location |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment