← Back to CLIs
Melvynx

gh

Manage GitHub via CLI - repos, issues, PRs, releases, gists, workflows. Use when user mentions 'gh', 'github cli', 'pull request', or wants to interact with GitHub.

Install

$ npx api2cli install gh

Details

Skill type: Official CLI
Auth type: bearer
Version: 1.0.0
Author: Melvynx
Views: 0

README

gh

Setup

macOS:

brew install gh

Linux:

apt install gh

Verify installation:

gh --version

Always use --json <fields> flag when calling commands programmatically.

Authentication

gh auth login

Check auth status:

gh auth status

Resources

Repos

CommandDescription
gh repo listList your repositories
gh repo list <owner>List repos for a user or org
gh repo create <name> --publicCreate a new public repo
gh repo create <name> --privateCreate a new private repo
gh repo clone <owner/repo>Clone a repository
gh repo view <owner/repo>View repo details
gh repo fork <owner/repo>Fork a repository
gh repo delete <owner/repo> --yesDelete a repository

Pull Requests

CommandDescription
gh pr listList open pull requests
gh pr list --state allList all pull requests
gh pr create --title "Fix" --body "Description"Create a pull request
gh pr view <number>View pull request details
gh pr checkout <number>Check out a pull request locally
gh pr merge <number>Merge a pull request
gh pr merge <number> --squashSquash merge a pull request
gh pr close <number>Close a pull request
gh pr review <number> --approveApprove a pull request
gh pr diff <number>View pull request diff
gh pr checks <number>View CI checks status

Issues

CommandDescription
gh issue listList open issues
gh issue create --title "Bug" --body "Description"Create an issue
gh issue view <number>View issue details
gh issue close <number>Close an issue
gh issue reopen <number>Reopen an issue
gh issue comment <number> --body "Comment"Add a comment
gh issue edit <number> --add-label bugAdd label to issue

Releases

CommandDescription
gh release listList releases
gh release create v1.0.0Create a release
gh release create v1.0.0 --generate-notesCreate release with auto-generated notes
gh release view <tag>View release details
gh release download <tag>Download release assets
gh release delete <tag>Delete a release

Workflows and Runs

CommandDescription
gh workflow listList workflows
gh workflow run <name>Trigger a workflow
gh run listList recent workflow runs
gh run view <id>View run details
gh run watch <id>Watch a run in progress
gh run rerun <id>Rerun a workflow run

Gists

CommandDescription
gh gist listList your gists
gh gist create file.txtCreate a gist from a file
gh gist create --public file.txtCreate a public gist
gh gist view <id>View a gist
gh gist edit <id>Edit a gist

API

CommandDescription
gh api repos/{owner}/{repo}Make a GET request to the GitHub API
gh api repos/{owner}/{repo}/issues --method POST --field title="Bug"Make a POST request
gh api graphql -f query='{ viewer { login } }'Make a GraphQL query

Global Flags

FlagDescription
--json <fields>Output specific fields as JSON
--jq <expression>Filter JSON output with jq
--repo <owner/repo>Specify target repository
--limit <n>Limit number of results
--webOpen in browser
Sponsors