answered from live GitHub & Hugging Face data
How do I set up a bot account for Codex to ensure its commits are attributed to a separate identity?
Use a GitHub App, not a machine account, if the goal is a separate identity for Codex. A machine account works, but GitHub's terms limit it to one free extra account per person, and the account needs a human owner. A GitHub App gives the agent its own bot identity and a short-lived token.
I found no GitHub or OpenAI documentation that describes a Codex-specific GitHub setup. The steps below use general GitHub rules. I could not check the maintenance signals for openai/codex because the repository lookup failed.
Option comparison
| Option | Separate identity | Credential | Limits from GitHub docs | Best for |
|---|---|---|---|---|
| Machine account | Yes. A real user account, such as codex-bot |
Password or PAT for that account | A human must create it and accept the terms. Only one free machine account is allowed in addition to a personal account. It must be used only for automated tasks. | One agent, a small team |
| GitHub App | Yes. Commits and PRs show as the app's bot | Installation access token | Token expires after 1 hour. It can be limited to chosen repositories and permissions. | Several agents, or any setup that needs scoped access |
| Your own account | No | Your credentials | None, but commits appear as you | Not a separate identity |
Option A: GitHub App (recommended)
- Register a GitHub App on your account or organization. Set only the permissions Codex needs, such as contents and pull requests.
- Install the app on one repository. Avoid "all repositories" unless you need it.
- Generate a JWT for the app. Then request an installation access token from
POST /app/installations/INSTALLATION_ID/access_tokens. You can limit the token to specific repositories and permissions. - Give Codex the installation token. Refresh it before it expires.
The installation token "will expire after 1 hour" (GitHub Docs). If Codex needs to act for a user, the app can also use a user access token. That token "only has permissions that both the user and the app have" (GitHub Docs).
Option B: Machine account
- Create a new GitHub account with a dedicated email address. A human must create it.
- Add the account to the repository or organization with the least role it needs.
- Create a token for the account with the smallest scopes that work. Store it in your secret manager.
GitHub's terms say a machine account "is used exclusively for performing automated tasks." The human owner "is ultimately responsible for the machine's actions" (GitHub Terms of Service, B.3).
How they relate
Both options create a separate actor. A GitHub App shows its own bot name on each commit and PR. A machine account shows as a normal user. One GitHub App shared by several agents shows them all as the same bot. Use one app per agent if you need to tell agents apart.
Recommendation
Choose a GitHub App if you run one or more agents. It gives short-lived, scoped tokens and its own identity. Choose a machine account only if your tool needs a normal user login. Keep it to one account and assign a human owner.
If you want a managed version of this setup, githug provides it. Each agent gets its own key that mints one-hour tokens for one repository. The hug CLI (hug init --repo owner/repo) sets it up. It is free during the beta.