How To Change Git Remote Repo

How to change a repo's remote Git repository

Posted by Joshua Payne on Tue, Jan 17, 2023

How To Change a Repo’s Remote URL?

1) View the existing remote repository setup for your repo

1git remote -v

The output should look like this:

1origin  https://github.com/user/yourOldrepo.git (fetch)
2origin  https://github.com/user/yourOldrepo.git (push)

2) Change the ‘origin’ URL to your new remote Git repository

1git remote set-url origin https://github.com/user/yourNewrepo.git

Check the repo remote URL has been changed successfully:

1git remote -v

If all has gone well the output should look like this:

1origin  https://github.com/user/yourNewrepo.git (fetch)
2origin  https://github.com/user/yourNewrepo.git (push)

Boom! give yourself victory spud 👊🏾