Skip to content

Instantly share code, notes, and snippets.

@MilesDowe
Last active March 14, 2018 00:12
Show Gist options
  • Save MilesDowe/d10350347856f445fb412c179a682145 to your computer and use it in GitHub Desktop.
Save MilesDowe/d10350347856f445fb412c179a682145 to your computer and use it in GitHub Desktop.
Migrate Git repos between sources
#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