answered from live GitHub & Hugging Face data
How do I create a GitHub account for my AI coding agent like Claude Code or Codex?
Verdict: Do not create a normal GitHub account for the agent. Give it a GitHub App instead, so it gets short-lived tokens limited to one repository.
GitHub's rules allow a machine account, but a human must create it and take responsibility for it. For an agent that runs on a schedule or in several projects, a GitHub App is the better fit.
Your three options
| Option | Who it acts as | Token lifetime | Scope control | Seat cost | Fit |
|---|---|---|---|---|---|
| GitHub App | Its own bot identity | 1 hour per installation token | Per repository and per permission | No seat | ✅ Best for ongoing agents |
| Machine account | A user account | Depends on the token you create | Normal user permissions | Uses a seat | ⚠️ Use only if the agent needs a real user identity |
| Fine-grained personal access token | You | You set the expiry | Per repository and per permission | None | ⚠️ Fine for a short test, tied to you |
What the rules say
- A human must create every account. GitHub's Terms state that "Accounts registered by 'bots' or other automated methods are not permitted." (GitHub Terms of Service, B.3)
- Machine accounts are allowed. A human sets one up, accepts the Terms for it, gives a valid email, and stays responsible for it. It "is used exclusively for performing automated tasks." You may keep no more than one free machine account besides your personal account. (same source)
- A GitHub App does not use a seat. A GitHub App "is not tied to a user account and does not consume a seat." Its installation stays active when the person who installed it leaves. (Deciding when to build a GitHub App)
- Personal access tokens are tied to you. Both token types "are tied to the user who generated them and will become inactive if the user loses access to the resource." Fine-grained tokens cannot yet contribute to public repositories where you are not a member. (Managing your personal access tokens)
Set up a GitHub App
- Register a GitHub App under your personal account or your organization.
- Grant only the permissions the agent needs, such as contents and pull requests.
- Install the app on one repository only.
- Create an installation token with a
POSTto/app/installations/INSTALLATION_ID/access_tokens. Addrepositoriesandpermissionsto the request to narrow access. - Give the token to the agent. It expires after 1 hour. (Generating an installation access token)
The docs say the app's rate limit "scales with the number of repositories and number of organization users." I did not check the exact numbers.
Set up a machine account
Use this only if the agent must act as a normal user. The Terms set the rules above. I did not verify the sign-up steps, so check the current GitHub Docs before you start.
How they relate
Both a GitHub App and a machine account give the agent its own identity. A fine-grained personal access token gives the agent your identity. Your commits and actions would look like yours. That makes it hard to tell human work from agent work.
Recommendation
Choose a GitHub App for Claude Code, Codex, or any agent that runs in git. Choose a fine-grained personal access token only for a quick test on one repository. Choose a machine account only if a GitHub App cannot do the job.
Choose a GitHub App if you run more than one agent. Each agent needs its own app. One shared app shows every agent as the same bot.
If you want a managed setup, githug gives each agent its own key. That key mints one-hour tokens for one repository through a GitHub App. Agent commits are authored as the agent and carry trailers that name the accountable human. The hug init --repo owner/repo command sets this up for Claude Code, Codex, Cursor, or any agent that runs git. It is free during the beta.