Delete a GitHub Label with gh label delete
There is no undo bin for a deleted GitHub label, so check the repository and name twice before you let gh label delete loose. Allow about five minutes. You need gh, an authenticated session with permission to manage labels, and the repository's OWNER/REPO name.
The route
Jump straight to the step you need, or tick off Done means at the end.
This guide uses GitHub CLI 2.87.3, installed here from the gh package. The command changes a remote repository, so do not run the final example until the target is confirmed.
1. Check the installed command
Confirm which executable will run and read its built-in help:
$ command -v gh
/home/linuxbrew/.linuxbrew/bin/gh
$ gh --version
gh version 2.87.3 (2026-02-23)
$ gh label delete --help
Delete a label from a repository
The local manual documents one required argument, <name>, and one command-specific option, --yes. The parent gh label command supplies -R and --repo for a different repository.
2. Pin down the repository and label
Write down both values before building the command. The repository selector accepts [HOST/]OWNER/REPO; for GitHub.com, OWNER/REPO is normally enough. Label names are case-sensitive in practice, and spaces are part of the name, so quote it:
$ repo='OWNER/REPO'
$ label='label-to-remove'
$ printf 'Repository: %s\nLabel: %s\n' "$repo" "$label"
Repository: OWNER/REPO
Label: label-to-remove
Replace both placeholders. Do not paste a repository from a browser tab just because its name looks familiar: check the owner, repository, host if there is one, and label spelling. There is no confirmation option that tells GitHub to keep a backup.
3. Look before you delete
Use the listing command to inspect the repository. It is read-only and shows the label's spelling, description and colour:
$ gh label list --repo "$repo" --search "$label"
NAME DESCRIPTION COLOR
label-to-remove Old workflow B60205
The exact columns and matches depend on the repository and installed CLI version. Label not shown? Stop and fix the repository or search value. A successful listing does not guarantee a later delete will succeed, since permissions and repository state can shift in between.
Checkpoint
Proceed only when the displayed repository and label are the ones you mean to change. If you cannot identify the target unambiguously, do not reach for --yes.
4. Delete interactively first
Select the repository and leave out --yes for a human confirmation:
$ gh label delete "$label" --repo "$repo"
? Delete label "label-to-remove" from OWNER/REPO? Yes
The prompt wording can vary slightly by release; read it before accepting. Answer no and the label stays put. This is the safer form for typing the command by hand. On a terminal, Ctrl-C also abandons the prompt before confirming, though it is not a recovery mechanism afterwards.
5. Save --yes for a reviewed script
Warning
--yes confirms deletion without prompting. It suits a carefully reviewed maintenance script, but it removes the last interactive pause you get:
$ gh label delete "$label" --repo "$repo" --yes
$ printf 'exit status: %s\n' "$?"
exit status: 0
- Never put an unreviewed variable or broad loop in front of it. Keep repository and label values explicit wherever you can.
- Let a mismatch fail loudly. It should error, not silently target a default repository.
- Skip sudo entirely. The relevant permission is the authenticated GitHub account or token, not the local Linux user.
6. Verify the result
Query the same repository again after deletion. A missing exact label is the result you want:
$ gh label list --repo "$repo" --search "$label"
NAME DESCRIPTION COLOR
another-label Other work 0E8A16
The search can still return similarly named labels, so check names rather than trusting an empty-looking description. On an API, authentication, repository or permission error, keep the error text and fix that before retrying; do not bolt --yes onto a command whose target is still uncertain.
Common traps and recovery
- No label name given. A local syntax error:
cannot delete label: name argument required, and nothing is deleted. - Name given but no --yes, non-interactively. The command refuses and says
--yesis required outside an interactive shell. That stops a silent destructive action in a pipeline, it does not validate the target for you. - -R is not for privileges. It is the short repository option, nothing to do with running as root:
$ gh label delete "$label" -R "$repo"
? Delete label "label-to-remove" from OWNER/REPO? Yes
Do not combine -R and --repo with conflicting values. If you deleted the wrong label, stop and write down the repository, name, description and colour from any review or audit data you have.
Recovery
There is no second delete command that fixes this. Recreate the label deliberately through the GitHub web interface or the create workflow, and only after checking the replacement details against what you recorded.
Done means
- Version and help checked. The installed
ghand its command help matched what you expected. - Target reviewed before deleting. Exact repository and label confirmed, not assumed.
- Right mode for the job. Interactive for manual work,
--yesreserved for reviewed automation. - Success confirmed, not assumed. Exit status checked and a follow-up listing matched expectations.
- No shortcuts taken. No
sudo, broad loop or unreviewed variable widened the change.