Skip to main content

Command referencegh issue close

gh issue close command (Linux & Windows / GitHub CLI)

Linux & WindowsGitHub CLIgitbeginner

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 / optionMeaning
-c, --commentAdd a closing comment.
-r, --reasonClose 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.

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.