Git - Changing the location of origin

When you need to move the location of origin (switching between GitLab, GitHub, Bitbucket, etc) you can just change the origin url and push your existing branch to the new remote.

Verify the current remote url for origin

git remote -v

Change the remote url for origin

git remote set-url origin <new-repo-url>

Verify the current remote url for origin

git remote -v

Push your branch to the new origin

git push

Wes Shaddix

Read more posts by this author.