auth(Authenticate gh and git with GitHub)
browse(Open the repository in the browser)
codespace(Connect to and manage your codespaces)
pr(Manage pull requests)
run(View details about workflow runs)
workflow(View details about GitHub Actions workflows)
Create command shortcuts
Make an authenticated GitHub API request
Generate shell completion scripts
Manage configuration for gh
Manage 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.
Create a local directory called
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.
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
Manage GPG keys
Search for repositories, issues, pull requests and users
Manage GitHub secrets
Manage SSH keys
Print information about relevant issues, pull requests, and notifications across repositories
Last modified 10 April 2022