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

Set up a GitHub App

  1. Register a GitHub App under your personal account or your organization.
  2. Grant only the permissions the agent needs, such as contents and pull requests.
  3. Install the app on one repository only.
  4. Create an installation token with a POST to /app/installations/INSTALLATION_ID/access_tokens. Add repositories and permissions to the request to narrow access.
  5. 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.

docs.github.com/en/site-policy/github-terms/github-terms-of-servicedocs.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/managing-your-personal-access-tokensdocs.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 · 11/15/2026

Ask your own open-source question →