How can I change the remote URL of a Git repository to point to a new location?

You can safely update the remote URL using this command:

git remote set-url origin <new-URL>

I’ve done this many times when moving between local, staging, or production remotes. It doesn’t affect your commit history at all, just tells Git where to fetch/push from now. You can verify it worked with git remote -v.