answered from live GitHub & Hugging Face data
How do I create a separate GitHub App for Codex to manage its identity and contributions?
Create your own GitHub App for Codex, install it on selected repositories, and keep its private key in a secret store. The Codex CLI repository does not handle this identity for you, so you must connect the app's tokens to Codex yourself.
What "Codex" means here
- openai/codex is the Codex CLI. ✅ It is actively maintained: pushed today, 134,236 stars, 715 contributors, Apache-2.0, latest release rust-v0.167.0 on 2026-11-06. Its README does not describe a GitHub App identity.
- OpenAI's coding agent on GitHub is different. When you enable "Allow Codex coding agent" in Copilot settings, GitHub installs an app named
openai code agent. You do not own that app, and it does not appear in your list of GitHub App installations. Its actions appear in the audit log (GitHub Docs).
Your own app is a separate identity. Follow the steps below for that.
Steps
- Open your account Settings, then Developer settings, then GitHub Apps. Click New GitHub App. For an organization, use the organization's settings instead (GitHub Docs).
- Enter a name of 34 characters or fewer. The name must be unique across GitHub. Name it for Codex, for example
codex-yourteam. - Enter a homepage URL. Use your repository URL if you have no website.
- Turn off Active if the app does not need webhooks.
- Choose the minimum permissions. For example, select read and write for Contents and Pull requests only if Codex must push branches and open pull requests.
- Under "Where can this GitHub App be installed?", select Only on this account.
- Click Create GitHub App. Note the App ID. Do not use the client ID for API calls (octokit/app.js README).
- Generate a private key from the app settings page. Download the
.pemfile. - Click Install App. Select Only select repositories, then choose the repositories Codex may change (GitHub Docs).
- Create an installation token for each run. Send a
POSTrequest to/app/installations/INSTALLATION_ID/access_tokenswith a signed JWT (GitHub Docs). - Pass
repositoriesandpermissionsin that request to narrow the token further.
Security facts from the docs
- An installation token expires after 1 hour. You can revoke it sooner (GitHub Docs).
- The private key grants access to every account where the app is installed. Store it in a key vault. Do not hard-code it (GitHub Docs).
- If you build the token logic yourself, use octokit/app.js. ✅ It is MIT-licensed, 191 stars, released v16.1.4 on 2026-08-02, pushed 2 days ago, and has 32 contributors. It regenerates expired tokens for you.
What I could not verify
- I did not find documentation that shows how Codex CLI reads a GitHub token. Check its documentation before you connect the token.
- I did not verify how commits from your app appear on GitHub. Test with a throwaway repository first.
Recommendation
Choose your own GitHub App if you run one agent on a few repositories. It gives Codex a separate identity and short-lived tokens. You must build the token step yourself.
If you run several agents and need each action traced to one agent and one person, use a tool that does this for you. githug gives each agent its own key. That key mints one-hour tokens for one repository. The agent can also get its own GitHub App, so its commits and pull requests show as its own bot. The hug init --repo owner/repo command sets this up. It is free during the beta.