answered from live GitHub & Hugging Face data
What are the differences in scope and usage between fine-grained PATs and GitHub App tokens for coding agents like Codex?
Verdict: For a coding agent, use a GitHub App installation token. Use a fine-grained PAT only for a single, short-lived task you run yourself. I could not check how OpenAI Codex authenticates to GitHub, so this is a general comparison based on GitHub's docs.
Comparison
| Aspect | Fine-grained PAT | GitHub App installation token |
|---|---|---|
| Owner | One user or one organization (the resource owner you pick) | The app, installed on user or org accounts |
| Lifetime | You choose. Infinite is allowed unless an org sets a maximum lifetime. | Expires after 1 hour. Source |
| Repository scope | Selected repositories, with a limit set by the owner | Installation scope, optionally narrowed per token with repositories or repository_ids (up to 500) |
| Permission scope | Fine-grained permissions chosen at creation | Subset of the app's granted permissions, set per token with permissions |
| Tied to a person | Yes. It stops working if the user loses access. | No. It stays installed when the installer leaves. |
| Seat use | Uses the user's account | Does not consume a seat |
| Rate limits | Per user | Scale with repository and org size |
| Revocation | User revokes, or it expires or is found leaked | Uninstall or revoke the app, or let the 1-hour token expire |
| Attribution | Actions show as the user | Actions show as the app, with the user noted if acting on their behalf |
Sources: PAT management, token expiration, deciding when to build a GitHub App.
Key differences for agents
Scope. A PAT is a user credential. Its power equals the user's access, limited by the token's settings. An installation token is limited by the app's install and permission grants. You can create a token for one repository with read-only contents access.
Lifetime. A PAT lasts until its expiry date, and it can be long. An installation token lasts one hour. If an agent leaks one, the damage ends quickly.
Gaps in PATs. GitHub lists limits on fine-grained PATs. They cannot contribute to public repos where the user is not a member. They cannot use the Checks API or Packages. They cannot reach more than one organization at once. Classic PATs have fewer gaps, but they are broader and less secure.
Shared identity. If several agents use one PAT, every action shows as that user. If several agents use one GitHub App, every action shows as the same bot. Neither gives each agent its own identity.
Token count. Fine-grained PATs have a limit of 50 per user. GitHub recommends a GitHub App for automation at scale.
Recommendation
- Choose a GitHub App if the agent runs unattended, works across repositories, or needs short-lived tokens. This is the default for agents.
- Choose a fine-grained PAT if you run one agent on one repository yourself for a short time. Set the shortest expiry you can.
- Avoid classic PATs for agents. They grant access to every repository you can reach.
If you run more than one agent, use a GitHub App. githug is one option here. It gives each agent its own key, which mints one-hour tokens limited to one repository. It can also give each agent its own GitHub App, so commits show as that agent. The beta is free. Check the githug docs for current scope before you rely on it.