class Git::Commands::Remote::SetUrl

‘git remote set-url` command

Replaces a URL in the named remote’s configuration. Sets the first URL for the remote matching regex <oldurl> (or the first URL if no <oldurl> is given) to <newurl>.

@example Replace the fetch URL for a remote

set_url = Git::Commands::Remote::SetUrl.new(execution_context)
set_url.call('origin', 'https://example.com/repo.git')

@example Replace the push URL for a remote

set_url = Git::Commands::Remote::SetUrl.new(execution_context)
set_url.call('origin', 'https://example.com/repo.git', push: true)

@example Replace a URL matching a regex

set_url = Git::Commands::Remote::SetUrl.new(execution_context)
set_url.call('origin', 'https://new.example.com/repo.git', 'old.example.com')

@note ‘arguments` block audited against git-scm.com/docs/git-remote/2.53.0

@see Git::Commands::Remote

@see git-scm.com/docs/git-remote git-remote

@api private