Class: Git::Commands::Remote::GetUrl Private

Inherits:
Base
  • Object
show all
Defined in:
lib/git/commands/remote/get_url.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 get-url command

Retrieves the fetch or push URL configured for the named remote.

Examples:

Retrieve the fetch URL for a remote

get_url = Git::Commands::Remote::GetUrl.new(execution_context)
get_url.call('origin')

Retrieve the push URL for a remote

get_url = Git::Commands::Remote::GetUrl.new(execution_context)
get_url.call('origin', push: true)

Retrieve all configured URLs for a remote

get_url = Git::Commands::Remote::GetUrl.new(execution_context)
get_url.call('origin', all: 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, **options) ⇒ Git::CommandLineResult

Execute the git remote get-url command

Parameters:

  • name (String)

    the remote name to query

  • options (Hash)

    command options

Options Hash (**options):

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

    query push URLs instead of fetch URLs

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

    return all configured URLs instead of only the first one

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (Git::FailedError)

    if git exits with a non-zero exit status



# File 'lib/git/commands/remote/get_url.rb', line 44