Command referencegh secret delete
gh secret delete command (Linux & Windows / GitHub CLI)
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 / option | Meaning |
|---|---|
| -a, --app | Application whose secret store to use. |
| -e, --env | Environment name. |
| -o, --org | Organization 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.
Related commands
- gh secret setCreate or update an Actions secret for a repository, environment, or organization.
- gh workflow listList GitHub Actions workflows defined in the repository.
- gh run listList recent GitHub Actions workflow runs for the repository.
- gh auth loginAuthenticate the GitHub CLI with GitHub.com or GitHub Enterprise so other gh commands can run.
- gh pr createCreate a pull request from the current branch with title, body, reviewers, and base branch options.
- gh pr mergeMerge a pull request using merge commit, squash, or rebase strategies.
- gitTrack source history and collaborate through distributed repositories.
- gh repo cloneClone a GitHub repository to your machine using your authenticated gh settings.
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.