answered from live GitHub & Hugging Face data
How do I create a GitHub App for Claude Code to manage its commits separately from my personal account?
Verdict: Create a GitHub App and use only its installation tokens. Installation tokens act as the app, not as your personal account. GitHub says installation access tokens "will attribute activity to your app," while user access tokens "will attribute activity to a user and to your app" (Best practices). Avoid user tokens if you want separation.
Steps
- Open your account Settings, then Developer settings, then GitHub Apps. Click New GitHub App (Registering a GitHub App).
- Enter a unique name of 34 characters or fewer. Example:
claude-code-bot. - Set Permissions to the minimum. For commits and PRs, this is likely Contents and Pull requests (my suggestion, not from the docs).
- Deselect Active if the app needs no webhooks.
- Under "Where can this GitHub App be installed?", select Only on this account.
- Click Create GitHub App.
- Generate a private key from the app settings. The JWT step requires it. I did not read the key-management page.
- Install the app on one repository. Select Only select repositories (Installing your own GitHub App).
- Find the installation ID with
GET /repos/{owner}/{repo}/installation(Generating an installation access token). - Create a JWT signed with RS256. Set
iatto 60 seconds in the past. Setexpto no more than 10 minutes ahead. Setissto the client ID (JWT docs). - Call
POST /app/installations/INSTALLATION_ID/access_tokenswith the JWT. Passrepositoriesto limit the token to one repository (installation token docs). - Give the token to Claude Code for git over HTTPS. I did not verify the exact git syntax or the Claude Code configuration in the docs.
Constraints to plan for
- Token life: Installation tokens expire after 1 hour. Your helper must mint a new one. The Octokit SDKs do this for you (installation token docs).
- Private key risk: The key "grants access to every account that the app is installed on." Store it in a key vault. GitHub says an environment variable is weaker (Best practices).
- Commit author: I did not confirm how GitHub displays App-made commits in the docs I read. Check one test commit after setup.
- Local git: If Claude Code commits with your SSH key or your
user.email, the commits stay under your name. The app token only helps when the push uses that token.
Recommendation
Use one GitHub App per agent when you need separate actors. Register it on your account, install it on one repository, and mint a 1-hour token for each run.
If you want this set up for you, githug provides a CLI (hug init --repo owner/repo) that configures an agent-specific key for Claude Code. It mints one-hour tokens scoped to one repository. It is free during the beta.