Skip to content

Instantly share code, notes, and snippets.

@janpaul
Created January 27, 2019 10:23
Show Gist options
  • Save janpaul/c190a0f5b72dc707107ecf5c59b64a8e to your computer and use it in GitHub Desktop.
Save janpaul/c190a0f5b72dc707107ecf5c59b64a8e to your computer and use it in GitHub Desktop.
move a git repo from one remote to another
PROJECT=datamonitor-common
[[ -d $PROJECT ]] && rm -rf $PROJECT
git clone [email protected]:ritense/$PROJECT.git
cd $PROJECT
for remote in `git branch -r | grep -v master `; do git checkout --track $remote ; done\n
git remote rename origin old-origin
git remote add origin [email protected]:rdm/$PROJECT.git
git push -u origin --all
git push -u origin "*:*"
git push -u origin --tags
#git remote remove old-origin
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment