gh issue close
Close issues, with a reason
gh issue close closes one or more issues from your terminal. Leave a closing comment in the same command, and mark whether the issue was actually completed or closed as not planned so your project history stays accurate.
gh issue close 42Syntax
gh issue close {<number> | <url>} [flags]Examples
Close an issue by number
gh issue close 42Close with a comment
gh issue close 42 --comment "Fixed in #45"Close as not planned
gh issue close 42 --reason "not planned"Bulk-close matching issues
gh issue list --label wontfix --json number --jq ".[].number" | xargs -n1 gh issue closeOptions & flags
| Flag | What it does |
|---|---|
| -c, --comment | Leave a closing comment. |
| -r, --reason | Reason for closing: "completed" or "not planned". |
How to use gh issue close, step by step
- Find the issue number with
gh issue list. - Run
gh issue close 42. - Add
--commentto explain why, and--reasonto categorize it. - Reopen later if needed with
gh issue reopen 42.
Common errors and fixes
GraphQL: Could not resolve to an issue or pull request with the number of 999
That number doesn't exist here. List valid issues with gh issue list.
HTTP 403: Resource not accessible by integration
Your token can't write to this repo. Re-authenticate with the right scopes via gh auth login.
Related commands
Frequently asked questions
How do I close an issue with GitHub CLI?
Run gh issue close <number>, for example gh issue close 42. Add --comment to leave a note and --reason to record whether it was completed or not planned.
How do I close multiple issues at once?
Pipe issue numbers into the command: gh issue list --label wontfix --json number --jq '.[].number' | xargs -n1 gh issue close.
Can I reopen an issue I closed?
Yes. Use gh issue reopen <number> to bring it back to the open state.