The Git remote URL is set with the src/main/java/hudson/plugins/git/UserRemoteConfig.java#UserRemoteConfig
class, and its groovy GUI configuration.
You can see an example of changing the URL in "How to change a Git URL in all Jenkins jobs"
def newUserRemoteConfigs = oldScm.userRemoteConfigs.collect {
new UserRemoteConfig(modifyGitUrl(it.url), it.name, it.refspec, it.credentialsId)
}
The OP reports a more up-to-date way to update the Git SCM URL, in "How to update job config files using the REST API and cURL?"
# Get current config
curl -X GET http://developer:developer@localhost:8080/job/test/config.xml -o mylocalconfig.xml
# Post updated config
curl -X POST http://developer:developer@localhost:8080/job/test/config.xml --data-binary "@mymodifiedlocalconfig.xml"
Obviously, replace:
developer:developer
with your username:password
localhost:8080
with your Jenkins URL
test
with your job name
This is based on the JENKINS Remote access API.