What's the best way to replace remote.origin.url in Git?
If they already have a remote called origin
but want the new remote to be called origin
then the most logical thing to do is rename or remove the existing remote called origin
and add a new one:
git remote rename origin old_origin
git remote add origin url://new/url.git
If you don't care about the old origin you can just reset the URL, but you would probably want to do a full git fetch
and a git remote prune origin
afterwards for tidiness.
git config remote.origin.url url://new/url.git
If you have a very recent git (>1.7.0), you have a remote sub command for this:
git remote set-url origin url://new/url.git