Skip to main content

Command referencegh secret delete

gh secret delete command (Linux & Windows / GitHub CLI)

Linux & WindowsGitHub CLIgitadvancedDestructive — use carefully

What it does

Delete an Actions secret from a repository, environment, or organization. When people search for gh secret delete, they usually want practical GitHub CLI flags, safe examples, and how this subcommand fits everyday PR and repo workflows on Linux, Windows, and macOS. Syntax, options, and copyable examples are below.

Delete an Actions secret from a repository, environment, or organization.

Syntax

gh secret delete <secret-name> [flags]

Common options

Flag / optionMeaning
-a, --appApplication whose secret store to use.
-e, --envEnvironment name.
-o, --orgOrganization name for org secrets.

Practical examples

Delete repo secret

gh secret delete OLD_API_KEY

Removes a repository-level Actions secret.

Delete env secret

gh secret delete DEPLOY_KEY --env staging

Removes a secret from the staging environment.

Common mistakes

  • Deleting a secret still referenced by required workflows.
  • Removing an org secret that multiple repositories depend on.

FAQ

What does gh secret delete do in GitHub CLI?

Delete an Actions secret from a repository, environment, or organization.

Does gh secret delete work on Windows and Linux?

Yes. The GitHub CLI (`gh`) runs on Linux, Windows, and macOS with the same subcommand syntax after you authenticate with `gh auth login`.

What is a practical gh secret delete example?

Try `gh secret delete OLD_API_KEY` — Removes a repository-level Actions secret.

Do I need a token in the command line for gh secret delete?

Prefer `gh auth login` so credentials stay in the system keyring or secure storage. Avoid pasting personal access tokens into shell history.

Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.