Command referencegh issue comment
gh issue comment command (Linux & Windows / GitHub CLI)
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 / option | Meaning |
|---|---|
| -b, --body | Comment text. |
| -F, --body-file | Read comment body from a file. |
| -w, --web | Open the web UI to write the comment. |
| --edit-last | Edit 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.
Related commands
- 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 issue closeClose one or more GitHub issues from the command line.
- 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 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.