Skip to content

Instantly share code, notes, and snippets.

@andmax
Last active December 8, 2019 08:16
Show Gist options
  • Save andmax/9422bf3eb626146cb7448366389c8796 to your computer and use it in GitHub Desktop.
Save andmax/9422bf3eb626146cb7448366389c8796 to your computer and use it in GitHub Desktop.
1- Migrate a git repo by first mirroring original (ORI) repo:
git clone --mirror <url to ORI repo> temp-dir
2- Cd to the mirror repo and check local tags and branches:
git tag
git branch -a
3- Remove the link with the original repo:
git remote rm origin
4- Link the local repo to the new repo:
git remote add origin <url to NEW repo>
5- Push all branches and tags to the new repo:
git push origin --all
git push --tags
6- For an existing repo, set the new repo url:
git remote set-url origin <url to NEW repo>
7- Make sure the new url is set:
git remote -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment