How to update git remotes

To list the existing remotes, we can use the following command:

git remote -v
#View existing remotes
origin  https://github.com/user/repo.git (fetch)
origin  https://github.com/user/repo.git (push)

Use the following command to set the remote to a new end point.

git remote set-url origin https://github.com/user/repo2.git
# Change the 'origin' remote's URL

Making sure that worked ;)

git remote -v
# Verify new remote URL
# origin  https://github.com/user/repo2.git (fetch)
# origin  https://github.com/user/repo2.git (push)

Reference: Github