answered from live GitHub & Hugging Face data

What are the differences in usage scenarios for fine-grained PATs, GitHub App installation tokens, and deploy keys for AI coding agents?

For AI coding agents, use a GitHub App installation token by default. Use a fine-grained PAT only for a short, single-user test. Use a deploy key only for one server that pulls or pushes one repository.

GitHub's docs support this order. GitHub recommends fine-grained PATs over classic PATs, but they are meant for access on behalf of yourself. Long-lived integrations should use a GitHub App (Managing your personal access tokens).

Comparison

Fine-grained PAT GitHub App installation token Deploy key
Identity The user who created it The app, not a user None. It is tied to the repository
Expiry Optional. Infinite lifetimes are allowed unless an org sets a maximum 1 hour, or less if revoked No expiry date
Scope One resource owner, selected repositories, chosen permissions Selected repositories and chosen permissions, set per token One repository. Read-only by default, write optional
Lifecycle Stops working if the user loses access Survives staff changes. Does not use a seat Stays active after the creator leaves
Rate limits User limits Dedicated limits that scale with the installation Not an API credential
Setup Minutes Create app, store private key, mint tokens in code Generate SSH key, add to repo

Sources: Token expiration and revocation, Generating an installation access token, Managing deploy keys.

Fine-grained PATs: a single-user test

GitHub App installation tokens: the default for agents

Deploy keys: narrow, long-lived, hard to audit

Recommendation

Use a GitHub App installation token for agents. Generate it per run, and scope it to one repository with the permissions the task needs. Use a fine-grained PAT only when you test an agent under your own account. Avoid deploy keys for agents unless one server must pull one repository.

Choose a fine-grained PAT if you need a fast test under your own name. Choose a GitHub App if more than one agent works in an org, or the work runs for a long time. Choose a deploy key if one server only clones or deploys one repository.

If you want each agent to have its own identity, githug provides this for coding agents. It issues one-hour, single-repo tokens through a GitHub App, and its beta CLI supports Claude Code, Codex, and Cursor.

docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokensdocs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-an-installation-access-token-for-a-github-appdocs.github.com/en/authentication/connecting-to-github-with-ssh/managing-deploy-keysdocs.github.com/en/authentication/keeping-your-account-and-data-secure/token-expiration-and-revocationdocs.github.com/en/apps/creating-github-apps/about-creating-github-apps/deciding-when-to-build-a-github-app
Answered live from GitHub & Hugging Face · anthropic/claude-haiku-5.5 · 10/17/2026

Ask your own open-source question →