Skip to content

Get‑GitRemote

viscalyxbot edited this page Sep 30, 2025 · 1 revision

SYNOPSIS

Retrieves the names or URL(s) of the specified Git remote or all remotes.

SYNTAX

Default (Default)

Get-GitRemote [[-Name] <String>] [<CommonParameters>]

PushUrl

Get-GitRemote [-Name] <String> [-PushUrl] [<CommonParameters>]

FetchUrl

Get-GitRemote [-Name] <String> [-FetchUrl] [<CommonParameters>]

DESCRIPTION

The Get-GitRemote commands retrieves the names or URL(s) of the specified Git remote or all remotes. It can be used to get the name of a remote or the URL(s) for fetching or pushing.

EXAMPLES

EXAMPLE 1

Get-GitRemote

Returns the names of all Git remotes.

EXAMPLE 2

Get-GitRemote -Name origin

Returns the name of the Git remote named 'origin' if it exist.

EXAMPLE 3

Get-GitRemote -Name origin -FetchUrl

Returns the URL for fetching from the Git remote named 'origin'.

EXAMPLE 4

Get-GitRemote -Name origin -PushUrl

Returns the URL for pushing to the Git remote named 'origin'.

PARAMETERS

-FetchUrl

Indicates that the URL(s) for fetching should be retrieved.

Type: SwitchParameter
Parameter Sets: FetchUrl
Aliases:

Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Name

Specifies the name of the Git remote.

Type: String
Parameter Sets: Default
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Type: String
Parameter Sets: PushUrl, FetchUrl
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PushUrl

Indicates that the URL(s) for pushing should be retrieved.

Type: SwitchParameter
Parameter Sets: PushUrl
Aliases:

Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None. You cannot pipe input to this function.

OUTPUTS

System.String[]

The function returns an array of strings representing the names or URL of

the specified Git remote or all remotes.

NOTES

RELATED LINKS

Clone this wiki locally