Skip to content

Instantly share code, notes, and snippets.

@devinschumacher
Created September 13, 2024 15:37
Show Gist options
  • Save devinschumacher/614d86b821c134e4935f9a20aa949528 to your computer and use it in GitHub Desktop.
Save devinschumacher/614d86b821c134e4935f9a20aa949528 to your computer and use it in GitHub Desktop.
How to create an issue in GitHub from the command line
title tags
How to create an issue in GitHub from the command line
git, github

How to create an issue in GitHub from the command line (without using the GitHub GUI or any apps)

The basic syntax:

gh issue create [flags]

Running gh issue create without flags will open an interactive prompt.

Or you can run it without the interactive prompt by providing the flags.

Common flags:

  • --title or -t: Set the issue title
  • --body or -b: Set the issue body
  • --label or -l: Add labels
  • --assignee or -a: Assign users

Example:

gh issue create --title "Bug: Login form not responsive" --body "The login form doesn't adjust properly on mobile devices" --label bug --assignee username

Creating issue in devinschumacher/repo

https://github.com/devinschumacher/repo/issues/1

Multiple labels and assignees:

To create an issue with multiple labels or assignees, repeat the flag:

gh issue create --title "feature: Dark mode" --body "Implement a dark mode option" --label enhancement --label ui --assignee dev1 --assignee dev2

Advanced usage:

  1. Create issue and add to project:

    gh issue create --project "Q2 Roadmap"
  2. Create issue with milestone:

    gh issue create --milestone "v1.0"
  3. Create issue and open in browser:

    gh issue create --web

Remember to run gh auth login if you haven't authenticated the GitHub CLI yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment