Skip to main content

Command referencegh issue comment

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

Linux & WindowsGitHub CLIgitbeginner

What it does

Add a comment to an existing GitHub issue. When people search for gh issue comment, 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.

Add a comment to an existing GitHub issue.

Syntax

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

Common options

Flag / optionMeaning
-b, --bodyComment text.
-F, --body-fileRead comment body from a file.
-w, --webOpen the web UI to write the comment.
--edit-lastEdit your last comment instead of creating a new one.

Practical examples

Quick comment

gh issue comment 42 --body "I can reproduce on main."

Posts a short update on issue 42.

From markdown

gh issue comment 42 -F ./note.md

Posts a longer comment from a file.

Edit last

gh issue comment 42 --edit-last --body "Updated repro steps."

Amends your most recent comment on the issue.

Common mistakes

  • Commenting on a PR with `gh issue comment` — prefer `gh pr comment` for pull requests.
  • Leaving unresolved `@` mentions that notify the wrong people.

FAQ

What does gh issue comment do in GitHub CLI?

Add a comment to an existing GitHub issue.

Does gh issue comment 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 comment example?

Try `gh issue comment 42 --body "I can reproduce on main."` — Posts a short update on issue 42.

Do I need a token in the command line for gh issue comment?

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.