Skip to content

Remove-GitHubSecret

SYNOPSIS

Deletes a secret from GitHub.

SYNTAX

AuthenticatedUser (Default)

Remove-GitHubSecret -Name <String> [-Context <Object>] [-ProgressAction <ActionPreference>] [-WhatIf]
 [-Confirm] [<CommonParameters>]

Environment

Remove-GitHubSecret -Owner <String> -Repository <String> -Environment <String> -Name <String>
 [-Context <Object>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

Repository

Remove-GitHubSecret -Owner <String> -Repository <String> -Name <String> [-Context <Object>]
 [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

Organization

Remove-GitHubSecret -Owner <String> -Name <String> [-Context <Object>] [-ProgressAction <ActionPreference>]
 [-WhatIf] [-Confirm] [<CommonParameters>]

ArrayInput

Remove-GitHubSecret -Name <String> [-Context <Object>] -InputObject <GitHubSecret[]>
 [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Removes a secret from a specified GitHub repository, environment, organization, or authenticated user. Supports both Actions and Codespaces secrets and requires appropriate authentication.

EXAMPLES

EXAMPLE 1

Remove-GitHubSecret -Owner PSModule -Repository Demo -Type actions -Name TEST

Deletes the secret named 'TEST' from the 'Demo' repository in the 'PSModule' organization.

EXAMPLE 2

Remove-GitHubSecret -Organization MyOrg -Type actions -Name API_KEY

Deletes the secret 'API_KEY' from the organization 'MyOrg'.

EXAMPLE 3

Remove-GitHubSecret -Owner MyUser -Repository MyRepo -Environment Production -Name DB_PASSWORD

Deletes the 'DB_PASSWORD' secret from the 'Production' environment in the 'MyRepo' repository.

PARAMETERS

-Owner

The account owner of the repository. The name is not case sensitive.

Type: String
Parameter Sets: Environment, Repository, Organization
Aliases: Organization, User

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Repository

The name of the repository without the .git extension. The name is not case sensitive.

Type: String
Parameter Sets: Environment, Repository
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Environment

The name of the environment.

Type: String
Parameter Sets: Environment
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Name

The name of the secret.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Context

The context to run the command in. Used to get the details for the API call. Can be either a string or a GitHubContext object.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: (Get-GitHubContext)
Accept pipeline input: False
Accept wildcard characters: False

-InputObject

{{ Fill InputObject Description }}

Type: GitHubSecret[]
Parameter Sets: ArrayInput
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
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

OUTPUTS

NOTES

Supports authentication using GitHub App tokens (IAT), Personal Access Tokens (PAT), or User Access Tokens (UAT).

https://psmodule.io/GitHub/Functions/Secrets/Remove-GitHubSecret/