January 19th 2024, 8:30:40 am EST #

I keep forgetting how to change the remote for a git repo.

1) View existing remotes

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

2) Change the ‘origin’ remote’s URL

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

3) Verify new remote URL

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