Command referencegh issue close
gh issue close command (Linux & Windows / GitHub CLI)
What it does
Close one or more GitHub issues from the command line. When people search for gh issue close, 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.
Close one or more GitHub issues from the command line.
Syntax
gh issue close {<number> | <url>} [flags]Common options
| Flag / option | Meaning |
|---|---|
| -c, --comment | Add a closing comment. |
| -r, --reason | Close reason when supported (completed, not planned). |
Practical examples
Close an issue
gh issue close 42
Marks issue 42 as closed.
Close with note
gh issue close 42 --comment "Fixed in main"
Closes and leaves a short explanation.
Not planned
gh issue close 42 --reason "not planned"
Closes with a not-planned reason when the API supports it.
Common mistakes
- Closing the wrong number after skimming `gh issue list`.
- Using close when you meant to transfer or relabel the issue.
Related commands
- gh issue listList issues in the current or specified GitHub repository with filters.
- gh issue viewShow details for a GitHub issue in the terminal or open it on the web.
- gh issue createOpen a new GitHub issue from the terminal with title, body, labels, and assignees.
- 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 issue close do in GitHub CLI?
Close one or more GitHub issues from the command line.
Does gh issue close 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 issue close example?
Try `gh issue close 42` — Marks issue 42 as closed.
Do I need a token in the command line for gh issue close?
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.