Website | Source | gh reference
auth (Authenticate gh and git with GitHub)browse (Open the repository in the browser)codespace (Connect to and manage your codespaces)gist (Manage gists)issue (Manage issues)pr (Manage pull requests)release (Manage releases)repo (Manage repositories)run (View details about workflow runs)workflow (View details about GitHub Actions workflows)aliasCreate command shortcuts
apiMake an authenticated GitHub API request
completionGenerate shell completion scripts
configManage configuration for gh
extensionManage gh extensions
gh create extension create: Prompts for name and language: Script (bash, Ruby, Python), Go, or "Other precompiled" (C++, Rust, etc).
The repository name must start with
gh-. The rest of the repository name is the name of the extension. The repository must have an executable file at its root with the same name as the repository or a set of precompiled binary executables attached to a release.
gh-whoamiCreate a local directory called gh-whoami.
In gh-whoami, create an executable file (such as a bash script) with the same name as the directory. Note: Make sure that your file is executable. On Unix, you can execute chmod +x file_name in the command line to make file_name executable. On Windows, you can run git init -b main, git add file_name, then git update-index --chmod=+x file_name.
Write your script:
#!/usr/bin/env bash
set -e
exec gh api user --jq '"You are @\(.login) (\(.name))."'
From your directory, install the extension as a local extension.
gh extension install .
Verify that your extension works.
gh whoami
From your directory, create a repository to publish your extension.
git init -b main
git add . && git commit -m "initial commit"
gh repo create gh-whoami --source=. --public --push
gpg-keyManage GPG keys
labelManage labels
searchSearch for repositories, issues, pull requests and users
secretManage GitHub secrets
ssh-keyManage SSH keys
statusPrint information about relevant issues, pull requests, and notifications across repositories
Last modified 02 November 2025