git remote change URL — switch origin or add new remote

# Check current remote URLs
git remote -v

# Change the origin URL
git remote set-url origin git@github.com:user/repo.git

You need to switch from HTTPS to SSH, the repository was renamed, or you moved it to a different host.

Switch from SSH to HTTPS

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

Add a second remote (e.g., both GitHub and GitLab)

git remote add gitlab git@gitlab.com:user/repo.git
git push gitlab main

Remove a remote entirely

git remote remove origin