Be robust against existing remote.origin config

I will take this opportunity to opine and say that I don't think sharing
remote config settings across repositories makes sense. Remotes belong
to the repository, and the URL has to be configured anyway. It breaks
the assumption that you can run "git remote add origin" in a blank repo.
Repository templates are a much nicer way to address any perceived
duplication.

Nonetheless, git allows this to happen and there are a number of
misguided blogposts advocating it, so we should be robust against it.

Closes #31107.