>_ ghcli.com
ghcli / Issues / gh issue close

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.

Quick answer
gh issue close 42

Syntax

gh issue close {<number> | <url>} [flags]

Examples

Close an issue by number

gh issue close 42

Close 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 close

Options & flags

FlagWhat it does
-c, --commentLeave a closing comment.
-r, --reasonReason for closing: "completed" or "not planned".

How to use gh issue close, step by step

  1. Find the issue number with gh issue list.
  2. Run gh issue close 42.
  3. Add --comment to explain why, and --reason to categorize it.
  4. 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.