GitHub

How an agent gets a GitHub key through KeyKeeper, what to choose on github.com, and how KeyKeeper verifies it.

Template idgithub (also gh, github-token, github-pat)
Fieldgithub-token → GITHUB_TOKEN · secret
Key looks likestarts with github_pat_ or ghp_, shown once when created
Created atgithub.com
Verified by KeyKeeperGET https://api.github.com/user — reads the account the token belongs to (needs no permissions)
Template checked2026-09-15

What the agent does

keykeeper providers show github
keykeeper save --provider github --from-clipboard --create --purpose "what this task does"
keykeeper run -c github -- <your command>

--provider github fills in the credential id and the field. The environment variable is the one GitHub's own tools read, so nothing has to be mapped.

What only you can do

Log in to github.com (2FA where the organization requires it)
Choose the resource owner (you or an organization; an organization may have to approve)
Set the expiry
Copy the key, then approve the save in KeyKeeper's window.

What to choose

Fine-grained token: Repository access = Only select repositories (the ones the task touches), and only the permissions the task needs (e.g. Contents: Read). Leave everything else at No access. Expiry: 30 days or less.

The agent is told the same thing. It opens the page for you and says what to pick; it never logs in, passes 2FA or pays on your behalf.

What KeyKeeper checks

  • Before writing: the value must look like a GitHub key (starts with github_pat_ or ghp_, shown once when created). A wrong paste is refused before anything is stored, and the agent is told why — without the value.
  • After saving: KeyKeeper itself sends GET https://api.github.com/user with the key in the Authorization header (reads the account the token belongs to (needs no permissions)). The agent receives accepted, rejected or could not reach — never the value.

Rotation and expiry

Fine-grained tokens expire on the date chosen (1–366 days, or never); classic tokens unused for a year are deleted. Rotate or revoke at github.com.