Fetch from original repo
git fetch origin
We can check for any missing branches that we need to create a local copy of:
git branch -a
git remote add new-origin NEW_REPO_URL
Now we are ready to push all local branches and tags to the new remote named new-origin:
git push --all new-origin
git push --tags new-origin
Let’s make new-origin the default remote:
git remote rm origin
Rename new-origin to just origin, so that it becomes the default remote:
git remote rename new-origin origin
Update any existing repos
git remote set-url origin NEW_REPO_URL