Cheatsheet - Github Cli Commands

Authentication & Status
gh auth login
Authenticate with GitHub (web or token-based)
gh auth logout
Log out from GitHub CLI
gh auth status
Display current authentication status
gh auth refresh
Refresh authentication scopes or credentials
gh auth switch
Switch between authenticated accounts
gh auth setup-git
Configure Git to use credentials managed by gh
Repository Management
gh repo clone [owner/repo]
Clone a repository
gh repo create
Create a new GitHub repository
gh repo delete [repo]
Delete a repository
gh repo rename [new-name]
Rename a repository
gh repo view
View repository in terminal
gh repo view [repo] [--web]
View repository in terminal or browser
gh repo sync [--source]
Sync local repo with another (e.g. upstream fork)
gh repo set-default [repo]
Set default repository for current directory
gh repo archive/unarchive [repo]
Archive or unarchive a repository
gh repo deploy-key [add|list|delete]
Manage deploy keys for a repo
gh repo edit
Change repository settings (e.g., visibility, features)
Issues
gh issue list
List issues
gh issue view [num]
View issue details
gh issue create
Create a new issue
gh issue close [num]
Close an issue
gh issue comment [num]
Comment on an issue
gh issue delete [num]
Delete an issue
gh issue status
Show issues relevant to the user in this repo
Pull Requests
gh pr list
List pull requests
gh pr view [num] [--web]
View a pull request locally or in browser
gh pr create
Create a new pull request
gh pr checkout [num]
Checkout a PR as a local branch
gh pr diff [num]
View changes in a pull request
gh pr checks [num]
Show CI status for a PR
gh pr edit [num]
Edit PR details (title, body, labels, etc.)
gh pr merge [num]
Merge a pull request (merge/rebase/squash)
gh pr status
View PRs relevant to your current branch or user
Workflows & Actions
gh run list
List recent workflow runs
gh run view [id]
View details of a workflow run
gh run cancel [id]
Cancel a running workflow
gh run download [id]
Download artifacts from a workflow
Secrets
gh secret list
List secrets (user/org/repo context)
gh secret set [name] --body "…"
Create or update a secret
gh secret delete [name]
Delete a secret
Projects
gh project list
List projects
gh project view [id] [--web]
View a project
gh project create
Create a new project
gh project close [id]
Close or reopen a project
gh project copy [id]
Copy a project (e.g. to reuse template)
gh project item-add [id] [--title …]
Add an item to a project
gh project item-list [id]
List items within a project
Gists
gh gist list
List your gists
gh gist create [files]
Create a new gist
gh gist view [id] [--web]
View gist in terminal or browser
gh gist delete [id]
Delete a gist
Aliases & Extensions
gh alias list
List configured aliases
gh alias set [name] [expansion]
Create or update an alias
gh alias delete [name]
Delete an alias
gh extension list
List installed extensions
gh extension install [owner/repo]
Install a gh extension
gh extension create [name]
Create a new extension
gh extension upgrade
Upgrade extensions (specific or all)
gh extension remove [name]
Remove an installed extension
Configuration & Help
gh config list
Show gh configuration
gh config set [key] [value]
Set a configuration option
gh config get [key]
Get a configuration value
gh config clear-cache
Clear CLI cache
gh help
Show general gh help or reference
gh [command] --help
Show help for a specific command
gh api [endpoint]
Make a lower‑level GitHub API request
Miscellaneous
gh browse [<num> or path] --web
Open PR, issue, repo, wiki in browser
gh completion --shell [bash|zsh|fish]
Generate shell auto‑completion script
gh cache list/delete
Manage GitHub Actions cache
gh codespace create/list/delete/ssh/code
Manage GitHub Codespaces
gh gpg-key add/list/delete
Manage GPG keys for commits and tags