gh reference
A comprehensive reference of all gh commands
Synopsis
gh reference
gh actions
Learn about working with GitHub actions
gh alias <command>
Create command shortcuts
gh alias delete <alias>
Delete an alias
gh alias list
List your aliases
gh alias set <alias> <expansion> [flags]
Create a shortcut for a gh command
-s, --shell Declare an alias to be passed through a shell interpreter
gh api <endpoint> [flags]
Make an authenticated GitHub API request
--cache duration Cache the response, e.g. "3600s", "60m", "1h"
-F, --field key=value Add a typed parameter in key=value format
-H, --header key:value Add a HTTP request header in key:value format
--hostname string The GitHub hostname for the request (default "github.com")
-i, --include Include HTTP response headers in the output
--input file The file to use as body for the HTTP request
-q, --jq string Query to select values from the response using jq syntax
-X, --method string The HTTP method for the request (default "GET")
--paginate Make additional HTTP requests to fetch all pages of results
-p, --preview strings Opt into GitHub API previews
-f, --raw-field key=value Add a string parameter in key=value format
--silent Do not print the response body
-t, --template string Format the response using a Go template
gh auth <command>
Login, logout, and refresh your authentication
gh auth login [flags]
Authenticate with a GitHub host
-h, --hostname string The hostname of the GitHub instance to authenticate with
-s, --scopes strings Additional authentication scopes for gh to have
-w, --web Open a browser to authenticate
--with-token Read token from standard input
gh auth logout [flags]
Log out of a GitHub host
-h, --hostname string The hostname of the GitHub instance to log out of
gh auth refresh [flags]
Refresh stored authentication credentials
-h, --hostname string The GitHub host to use for authentication
-s, --scopes strings Additional authentication scopes for gh to have
gh auth status [flags]
View authentication status
-h, --hostname string Check a specific hostname's auth status
-t, --show-token Display the auth token
gh completion -s <shell>
Generate shell completion scripts
-s, --shell string Shell type: {bash|zsh|fish|powershell}
gh config <command>
Manage configuration for gh
gh config get <key> [flags]
Print the value of a given configuration key
-h, --host string Get per-host setting
gh config set <key> <value> [flags]
Update configuration with a value for the given key
-h, --host string Set per-host setting
gh gist <command>
Manage gists
gh gist clone <gist> [<directory>] [-- <gitflags>...]
Clone a gist locally
gh gist create [<filename>... | -] [flags]
Create a new gist
-d, --desc string A description for this gist
-f, --filename string Provide a filename to be used when reading from STDIN
-p, --public List the gist publicly (default: private)
-w, --web Open the web browser with created gist
gh gist delete {<id> | <url>}
Delete a gist
gh gist edit {<id> | <url>} [flags]
Edit one of your gists
-a, --add string Add a new file to the gist
-f, --filename string Select a file to edit
gh gist list [flags]
List your gists
-L, --limit int Maximum number of gists to fetch (default 10)
--public Show only public gists
--secret Show only secret gists
gh gist view [<id> | <url>] [flags]
View a gist
-f, --filename string Display a single file from the gist
--files List file names from the gist
-r, --raw Print raw instead of rendered gist contents
-w, --web Open gist in the browser
gh issue <command>
Manage issues
gh issue close {<number> | <url>}
Close issue
gh issue comment {<number> | <url>} [flags]
Create a new issue comment
-b, --body string Supply a body. Will prompt for one otherwise.
-F, --body-file file Read body text from file
-e, --editor Add body using editor
-w, --web Add body in browser
gh issue create [flags]
Create a new issue
-a, --assignee login Assign people by their login. Use "@me" to self-assign.
-b, --body string Supply a body. Will prompt for one otherwise.
-F, --body-file file Read body text from file
-l, --label name Add labels by name
-m, --milestone name Add the issue to a milestone by name
-p, --project name Add the issue to projects by name
--recover string Recover input from a failed run of create
-t, --title string Supply a title. Will prompt for one otherwise.
-w, --web Open the browser to create an issue
gh issue delete {<number> | <url>}
Delete issue
gh issue edit {<number> | <url>} [flags]
Edit an issue
--add-assignee login Add assigned users by their login. Use "@me" to assign yourself.
--add-label name Add labels by name
--add-project name Add the issue to projects by name
-b, --body string Set the new body.
-F, --body-file file Read body text from file
-m, --milestone name Edit the milestone the issue belongs to by name
--remove-assignee login Remove assigned users by their login. Use "@me" to unassign yourself.
--remove-label name Remove labels by name
--remove-project name Remove the issue from projects by name
-t, --title string Set the new title.
gh issue list [flags]
List and filter issues in this repository
-a, --assignee string Filter by assignee
-A, --author string Filter by author
-q, --jq expression Filter JSON output using a jq expression
--json fields Output JSON with the specified fields
-l, --label strings Filter by labels
-L, --limit int Maximum number of issues to fetch (default 30)
--mention string Filter by mention
-m, --milestone number Filter by milestone number or `title`
-S, --search query Search issues with query
-s, --state string Filter by state: {open|closed|all} (default "open")
-t, --template string Format JSON output using a Go template
-w, --web Open the browser to list the issue(s)
gh issue reopen {<number> | <url>}
Reopen issue
gh issue status [flags]
Show status of relevant issues
-q, --jq expression Filter JSON output using a jq expression
--json fields Output JSON with the specified fields
-t, --template string Format JSON output using a Go template
gh issue transfer {<number> | <url>} <destination-repo>
Transfer issue to another repository
gh issue view {<number> | <url>} [flags]
View an issue
-c, --comments View issue comments
-q, --jq expression Filter JSON output using a jq expression
--json fields Output JSON with the specified fields
-t, --template string Format JSON output using a Go template
-w, --web Open an issue in the browser
gh pr <command>
Manage pull requests
gh pr checkout {<number> | <url> | <branch>} [flags]
Check out a pull request in git
--detach Checkout PR with a detached HEAD
-f, --force Reset the existing local branch to the latest state of the pull request
--recurse-submodules Update all submodules after checkout
gh pr checks [<number> | <url> | <branch>] [flags]
Show CI status for a single pull request
-w, --web Open the web browser to show details about checks
gh pr close {<number> | <url> | <branch>} [flags]
Close a pull request
-d, --delete-branch Delete the local and remote branch after close
gh pr comment [<number> | <url> | <branch>] [flags]
Create a new pr comment
-b, --body string Supply a body. Will prompt for one otherwise.
-F, --body-file file Read body text from file
-e, --editor Add body using editor
-w, --web Add body in browser
gh pr create [flags]
Create a pull request
-a, --assignee login Assign people by their login. Use "@me" to self-assign.
-B, --base branch The branch into which you want your code merged
-b, --body string Body for the pull request
-F, --body-file file Read body text from file
-d, --draft Mark pull request as a draft
-f, --fill Do not prompt for title/body and just use commit info
-H, --head branch The branch that contains commits for your pull request (default: current branch)
-l, --label name Add labels by name
-m, --milestone name Add the pull request to a milestone by name
--no-maintainer-edit Disable maintainer's ability to modify pull request
-p, --project name Add the pull request to projects by name
--recover string Recover input from a failed run of create
-r, --reviewer handle Request reviews from people or teams by their handle
-t, --title string Title for the pull request
-w, --web Open the web browser to create a pull request
gh pr diff [<number> | <url> | <branch>] [flags]
View changes in a pull request
--color string Use color in diff output: {always|never|auto} (default "auto")
gh pr edit [<number> | <url> | <branch>] [flags]
Edit a pull request
--add-assignee login Add assigned users by their login. Use "@me" to assign yourself.
--add-label name Add labels by name
--add-project name Add the pull request to projects by name
--add-reviewer login Add reviewers by their login.
-B, --base branch Change the base branch for this pull request
-b, --body string Set the new body.
-F, --body-file file Read body text from file
-m, --milestone name Edit the milestone the pull request belongs to by name
--remove-assignee login Remove assigned users by their login. Use "@me" to unassign yourself.
--remove-label name Remove labels by name
--remove-project name Remove the pull request from projects by name
--remove-reviewer login Remove reviewers by their login.
-t, --title string Set the new title.
gh pr list [flags]
List and filter pull requests in this repository
-a, --assignee string Filter by assignee
-A, --author string Filter by author
-B, --base string Filter by base branch
-q, --jq expression Filter JSON output using a jq expression
--json fields Output JSON with the specified fields
-l, --label strings Filter by labels
-L, --limit int Maximum number of items to fetch (default 30)
-S, --search query Search pull requests with query
-s, --state string Filter by state: {open|closed|merged|all} (default "open")
-t, --template string Format JSON output using a Go template
-w, --web Open the browser to list the pull requests
gh pr merge [<number> | <url> | <branch>] [flags]
Merge a pull request
--auto Automatically merge only after necessary requirements are met
-b, --body text Body text for the merge commit
-F, --body-file file Read body text from file
-d, --delete-branch Delete the local and remote branch after merge
--disable-auto Disable auto-merge for this pull request
-m, --merge Merge the commits with the base branch
-r, --rebase Rebase the commits onto the base branch
-s, --squash Squash the commits into one commit and merge it into the base branch
gh pr ready [<number> | <url> | <branch>]
Mark a pull request as ready for review
gh pr reopen {<number> | <url> | <branch>}
Reopen a pull request
gh pr review [<number> | <url> | <branch>] [flags]
Add a review to a pull request
-a, --approve Approve pull request
-b, --body string Specify the body of a review
-F, --body-file file Read body text from file
-c, --comment Comment on a pull request
-r, --request-changes Request changes on a pull request
gh pr status [flags]
Show status of relevant pull requests
-q, --jq expression Filter JSON output using a jq expression
--json fields Output JSON with the specified fields
-t, --template string Format JSON output using a Go template
gh pr view [<number> | <url> | <branch>] [flags]
View a pull request
-c, --comments View pull request comments
-q, --jq expression Filter JSON output using a jq expression
--json fields Output JSON with the specified fields
-t, --template string Format JSON output using a Go template
-w, --web Open a pull request in the browser
gh release <command>
Manage GitHub releases
gh release create <tag> [<files>...]
Create a new release
-d, --draft Save the release as a draft instead of publishing it
-n, --notes string Release notes
-F, --notes-file file Read release notes from file
-p, --prerelease Mark the release as a prerelease
--target branch Target branch or full commit SHA (default: main branch)
-t, --title string Release title
gh release delete <tag> [flags]
Delete a release
-y, --yes Skip the confirmation prompt
gh release download [<tag>] [flags]
Download release assets
-D, --dir string The directory to download files into (default ".")
-p, --pattern stringArray Download only assets that match a glob pattern
gh release list [flags]
List releases in a repository
-L, --limit int Maximum number of items to fetch (default 30)
gh release upload <tag> <files>... [flags]
Upload assets to a release
--clobber Overwrite existing assets of the same name
gh release view [<tag>] [flags]
View information about a release
-w, --web Open the release in the browser
gh repo <command>
Create, clone, fork, and view repositories
gh repo clone <repository> [<directory>] [-- <gitflags>...]
Clone a repository locally
gh repo create [<name>] [flags]
Create a new repository
-y, --confirm Skip the confirmation prompt
-d, --description string Description of the repository
--enable-issues Enable issues in the new repository (default true)
--enable-wiki Enable wiki in the new repository (default true)
-h, --homepage URL Repository home page URL
--internal Make the new repository internal
--private Make the new repository private
--public Make the new repository public
-t, --team name The name of the organization team to be granted access
-p, --template repository Make the new repository based on a template repository
gh repo fork [<repository>] [-- <gitflags>...] [flags]
Create a fork of a repository
--clone Clone the fork {true|false}
--remote Add remote for fork {true|false}
--remote-name string Specify a name for a fork's new remote. (default "origin")
gh repo list [<owner>] [flags]
List repositories owned by user or organization
--archived Show only archived repositories
--fork Show only forks
-l, --language string Filter by primary coding language
-L, --limit int Maximum number of repositories to list (default 30)
--no-archived Omit archived repositories
--private Show only private repositories
--public Show only public repositories
--source Show only non-forks
gh repo view [<repository>] [flags]
View a repository
-b, --branch string View a specific branch of the repository
-w, --web Open a repository in the browser
gh run <command>
View details about workflow runs
gh run download [<run-id>] [flags]
Download artifacts generated by a workflow run
-D, --dir string The directory to download artifacts into (default ".")
-n, --name stringArray Only download artifacts that match any of the given names
gh run list [flags]
List recent workflow runs
-L, --limit int Maximum number of runs to fetch (default 20)
-w, --workflow string Filter runs by workflow
gh run rerun [<run-id>]
Rerun a failed run
gh run view [<run-id>] [flags]
View a summary of a workflow run
--exit-status Exit with non-zero status if run failed
-j, --job string View a specific job ID from a run
--log View full log for either a run or specific job
--log-failed View the log for any failed steps in a run or specific job
-v, --verbose Show job steps
-w, --web Open run in the browser
gh run watch <run-id> [flags]
Watch a run until it completes, showing its progress
--exit-status Exit with non-zero status if run fails
-i, --interval int Refresh interval in seconds (default 3)
gh secret <command>
Manage GitHub secrets
gh secret list [flags]
List secrets
-o, --org string List secrets for an organization
gh secret remove <secret-name> [flags]
Remove an organization or repository secret
-o, --org string List secrets for an organization
gh secret set <secret-name> [flags]
Create or update secrets
-b, --body string A value for the secret. Reads from STDIN if not specified.
-o, --org string List secrets for an organization
-r, --repos selected List of repository names for selected visibility
-v, --visibility all Set visibility for an organization secret: all, `private`, or `selected` (default "private")
gh ssh-key <command>
Manage SSH keys
gh ssh-key add [<key-file>] [flags]
Add an SSH key to your GitHub account
-t, --title string Title for the new key
gh ssh-key list
Lists SSH keys in your GitHub account
gh workflow <command>
View details about GitHub Actions workflows
gh workflow disable [<workflow-id> | <workflow-name>]
Disable a workflow
gh workflow enable [<workflow-id> | <workflow-name>]
Enable a workflow
gh workflow list [flags]
List workflows
-a, --all Show all workflows, including disabled workflows
-L, --limit int Maximum number of workflows to fetch (default 50)
gh workflow run [<workflow-id> | <workflow-name>] [flags]
Run a workflow by creating a workflow_dispatch event
-F, --field key=value Add a string parameter in key=value format, respecting @ syntax
--json Read workflow inputs as JSON via STDIN
-f, --raw-field key=value Add a string parameter in key=value format
-r, --ref string The branch or tag name which contains the version of the workflow file you'd like to run
gh workflow view [<workflow-id> | <workflow-name> | <filename>] [flags]
View the summary of a workflow
-r, --ref string The branch or tag name which contains the version of the workflow file you'd like to view
-w, --web Open workflow in the browser
-y, --yaml View the workflow yaml file
Options inherited from parent commands
--help Show help for command

