Skip to content

Instantly share code, notes, and snippets.

@iforwms
Last active October 26, 2018 09:50
Show Gist options
  • Save iforwms/d6a7b16bf24bf5318ef3156892effb53 to your computer and use it in GitHub Desktop.
Save iforwms/d6a7b16bf24bf5318ef3156892effb53 to your computer and use it in GitHub Desktop.
Move a repository from one owner to another

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment