answered from live GitHub & Hugging Face data

What are the differences in scope and expiration for fine-grained PATs and GitHub App tokens when used by AI coding agents?

A GitHub App installation token is the better choice for an AI coding agent. It expires after one hour and can be limited to one repository per request. A fine-grained PAT lasts as long as you set it, and it acts as you.

Property Fine-grained PAT GitHub App installation token
Lifetime Set at creation. Infinite lifetimes are allowed, unless an org or enterprise maximum lifetime policy blocks them. Expires after 1 hour.
Repository scope Chosen at creation under "Repository access". Applies to every use of the token. Set per token with repositories or repository_ids. Can be narrower than the installation.
Permission scope Fine-grained permissions chosen at creation. Set per token with permissions. Can be a subset of what the app has. Defaults to all app permissions.
Resource owner One user or one organization. One installation, which is one account or org where the app is installed.
Identity Acts as the user who created it. Actions show as that user. Acts as the app's bot.
Revocation Revoked when it expires, when the owner loses access, after a year of disuse, or when pushed publicly. Ends when the hour ends. The app owner or the installing user can also revoke access.
Limits 50 tokens per user. Org approval can apply. Scales for automation.

Scope differences

Expiration differences

Recommendation

Choose a GitHub App token if the agent must run unattended. Choose a fine-grained PAT if the agent must act as you and only needs a few repos.

If you want this setup without building the app yourself, githug provides it. Its hug CLI gives each agent its own key. That key mints one-hour tokens for one repo through a GitHub App. It is free during the beta.

I did not check the org-level maximum lifetime policy page or the full fine-grained permissions list, so the details of those policies are not covered here.

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/keeping-your-account-and-data-secure/token-expiration-and-revocation
Answered live from GitHub & Hugging Face · anthropic/claude-haiku-5.5 · 10/23/2026

Ask your own open-source question →