Skip to content

Remove-GitHubSecret

SYNOPSIS

Deletes a secret from GitHub.

SYNTAX

AuthenticatedUser (Default)

Remove-GitHubSecret -Name <string> [-Context <Object>] [-WhatIf] [-Confirm] [<CommonParameters>]

Environment

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

Repository

Remove-GitHubSecret -Owner <string> -Repository <string> -Name <string> [-Context <Object>]
 [-WhatIf] [-Confirm] [<CommonParameters>]

Organization

Remove-GitHubSecret -Owner <string> -Name <string> [-Context <Object>] [-WhatIf] [-Confirm]
 [<CommonParameters>]

ArrayInput

Remove-GitHubSecret -Name <string> -InputObject <GitHubSecret[]> [-Context <Object>] [-WhatIf]
 [-Confirm] [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- cf
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-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: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Environment

The name of the environment.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Environment
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-InputObject

{{ Fill InputObject Description }}

Type: GitHubSecret[]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: ArrayInput
  Position: Named
  IsRequired: true
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Name

The name of the secret.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Owner

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

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases:
- Organization
- User
ParameterSets:
- Name: Environment
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
- Name: Repository
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
- Name: Organization
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Repository

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

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Environment
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
- Name: Repository
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-WhatIf

Runs the command in a mode that only reports what would happen without performing the actions.

Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- wi
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

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

INPUTS

System.String

{{ Fill in the Description }}

GitHubSecret[]

{{ Fill in the Description }}

OUTPUTS

NOTES

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