gh auth tokenPrint the active token for scripting.
Authentication, enterprise usage, aliases, extensions, completion, org secrets, and administrative helpers.
Credential flows, env vars, and multi-host usage.
gh auth tokenPrint the active token for scripting.
gh auth switchSwitch between authenticated accounts on a host.
gh auth setup-gitConfigure Git to use GitHub CLI as a credential helper.
gh config set git_protocol sshSet the preferred Git protocol used by gh.
printenv GITHUB_TOKEN | gh auth login --with-tokenAuthenticate non-interactively using a token piped from stdin.
Authenticate automation against GitHub Enterprise Server using env vars.
export GH_HOST=github.example.com && export GH_ENTERPRISE_TOKEN=tokenAuthenticate automation against GitHub Enterprise Server using env vars.
export GH_HOST=github.example.comSet the default host for gh commands.
export GH_REPO=my-org/platform-apiSet the default repository context for scripts.
Customize gh for faster workflows.
gh alias listList configured aliases.
gh alias set pv "pr view"Create a simple alias.
gh alias set cleanup '!git branch --merged | egrep -v "(^\*|main|master)" | xargs -r git branch -d'Create a shell-powered alias.
gh alias delete pvDelete a configured alias.
gh alias import aliases.yml --clobberImport aliases from a YAML file.
gh extension listList installed gh extensions.
gh extension install dlvhdr/gh-dashInstall a GitHub CLI extension from a repo.
gh extension upgrade --allUpgrade installed extensions.
gh extension remove dlvhdr/gh-dashUninstall an extension.
gh completion -s bash > /etc/bash_completion.d/ghGenerate shell completion for Bash.
gh completion -s zsh > "${fpath[1]}/_gh"Generate shell completion for Zsh.
gh completion -s fish > ~/.config/fish/completions/gh.fishGenerate shell completion for Fish.
Useful org-level and admin-oriented commands.
gh org listList organizations visible to your account.
gh project list --owner @meList GitHub Projects for an owner.
gh project view 5 --owner my-orgShow a GitHub Project.
gh secret list --org my-orgList organization secrets.
gh secret set MY_TOKEN --org my-org --visibility all < token.txtCreate an organization secret.
gh variable list --org my-orgList organization variables.
gh variable set APP_REGION --org my-org --body us-west-2Create or update an organization variable.
gh ssh-key add ~/.ssh/id_ed25519.pub --title "work-laptop"Upload an SSH public key.
gh gpg-key add ~/.gnupg/public.ascUpload a GPG key.
gh license listList common software licenses.
gh license view mitShow a license template body.