Class: Git::Commands::Remote::SetUrlAdd Private

Inherits:
Base
  • Object
show all
Defined in:
lib/git/commands/remote/set_url_add.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Note:

arguments block audited against https://git-scm.com/docs/git-remote/2.53.0

git remote set-url --add command

Appends a new URL to the named remote's fetch or push URL list.

Examples:

Add an additional fetch URL to an existing remote

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

Add a push URL to an existing remote

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

See Also:

Instance Method Summary collapse

Methods inherited from Base

allow_exit_status, arguments, #initialize, requires_git_version, skip_version_validation

Constructor Details

This class inherits a constructor from Git::Commands::Base

Instance Method Details

#call(name, newurl, **options) ⇒ Git::CommandLineResult

Execute the git remote set-url --add command

Parameters:

  • name (String)

    the remote name to update

  • newurl (String)

    the URL to append

  • options (Hash)

    command options

Options Hash (**options):

  • :push (Boolean, nil) — default: nil

    add a push URL instead of a fetch URL

Returns:

Raises:



# File 'lib/git/commands/remote/set_url_add.rb', line 41