You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gh repo delete: warn or error when --yes is ignored without an explicit owner/repo #12033
For safety, when no repository argument is provided, the --yes flag is ignored and you will be prompted for confirmation. To delete the current repository non-interactively, specify it explicitly (e.g., gh repo delete owner/repo --yes).
Deletion requires authorization with the delete_repo scope. To authorize, run gh auth refresh -s delete_repo.
However, when I run gh repo delete --yes (from inside a repository) there is no warning that --yes is being ignored. This made it hard to understand why the command wasn’t behaving non-interactively.
Steps to Reproduce
cd into any local Git repository that is connected to GitHub.
Run:
gh repo delete --yes
Observe that the command prompts interactively (as designed) but does not warn that --yes is ignored in this mode.
Actual Behavior
--yes is silently ignored when no owner/repo argument is provided.
No warning or error is shown, so users may assume --yes should make it non-interactive.
Expected Behavior
If --yes is passed without an explicit owner/repo, the CLI should at least warn, or preferably error, explaining why it can’t proceed non-interactively.
Suggested Fixes (any of these would help)
Warn and continue interactively (most conservative):
Print to stderr:
Warning: --yes is ignored when no repository is specified.
To delete non-interactively, run: gh repo delete OWNER/REPO --yes
Error out (clearer for scripts/CI):
Exit non-zero with:
Error: --yes requires an explicit repository argument (OWNER/REPO) for safety.
Docs/UI nudge in the prompt:
If the prompt appears while --yes was provided, append a one-line note:
Note: --yes is ignored without an explicit repository. Use: gh repo delete OWNER/REPO --yes
Rationale
Silently ignoring a flag is surprising and makes troubleshooting slower. A warning or error would:
Align behavior with the help text.
Prevent confusion for users expecting non-interactive deletion.
Help CI scripts fail fast with a clear message rather than hanging on a prompt.
All good points, and very reasonable solutions 🤔 I'm not sure which option is best but I think I lean towards the option 1 you've presented. I don't think it would hurt to print a message on stderr when --yes is ignored. I think it would make sense to only print this message to stderr when we can't prompt because we have another message that prints when we cannot prompt, see below.
I also want to note that if we can't prompt, we do currently give an error and exit in this case - so that should cover the transparency in CI case:
Thank you for your issue! We have categorized it as a feature request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the
help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
I agree with @BagToad that we should just print a warning in interactive mode. The other case is already covered with a non-zero exit code and message. I'll put down the A/C in the next comment.
Given I'm running gh interactively from a cloned repo directory When I run gh repo delete --yes Then I see the below warning message on stderr and then the prompt to confirm the repo name:
Warning: `--yes` is ignored since no repository was specified
Activity
BagToad commentedon Oct 27, 2025
Hey @Shion1305, thanks for this! ✨
All good points, and very reasonable solutions 🤔 I'm not sure which option is best but I think I lean towards the option 1 you've presented. I don't think it would hurt to print a message on stderr when
--yesis ignored. I think it would make sense to only print this message to stderr when we can't prompt because we have another message that prints when we cannot prompt, see below.I also want to note that if we can't prompt, we do currently give an error and exit in this case - so that should cover the transparency in CI case:
cli/pkg/cmd/repo/delete/delete.go
Lines 60 to 67 in 0b1b5fe
cc @babakks since we worked on this safety feature together - WDYT?
github-actions commentedon Oct 27, 2025
Thank you for your issue! We have categorized it as a feature request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
Shion1305 commentedon Oct 28, 2025
Hey @BagToad, thanks for the positive feedback! I’d love to take this on if you’re okay with it. Could you assign me? I can open a PR this week.
onsni commentedon Oct 28, 2025
babakks commentedon Oct 28, 2025
I agree with @BagToad that we should just print a warning in interactive mode. The other case is already covered with a non-zero exit code and message. I'll put down the A/C in the next comment.
babakks commentedon Oct 28, 2025
Acceptance Criteria
Given I'm running
ghinteractively from a cloned repo directoryWhen I run
gh repo delete --yesThen I see the below warning message on stderr and then the prompt to confirm the repo name:
babakks commentedon Oct 28, 2025
@Shion1305 I just added help wantedContributions welcome
to this. So, feel free to submit a PR for it.
💡 (gh repo delete) Add warning when `--yes` is ignored without a repo…
Merge pull request #12039 from Shion1305/shion/feat-12033
build(deps): update cli/cli to v2.83.0