Aident AI

How to Use Multiple GitHub Accounts in Claude Code With Aident
If Claude Code needs to work across a personal GitHub account and a work GitHub account, connect both identities in Aident Vault, give each connection an unmistakable alias, and pass the intended alias on every GitHub Action. Verify the routed identity with an authenticated-user identity check before any repository write. Do not rely on whichever account happened to be connected last.
This solves a narrower problem than switching Claude subscriptions or terminal Git identities. Anthropic issue 27302 has hundreds of reactions and comments asking for multiple connector accounts because one global connector identity does not fit users who cross personal, work, client, or organization boundaries. GitHub CLI supports multiple authenticated accounts too, but gh auth switch changes the active account for a host. An agent workflow needs a selection that travels with the exact Action instead of hidden global state.
First separate the three account layers
People often say "switch GitHub accounts" while referring to different systems. Diagnose the layer before changing credentials.
Layer | What it controls | Correct selector |
|---|---|---|
Claude account | Claude subscription, organization, history, and configuration | Claude profile or organization switcher |
Git author | Name and email written into commits | Repository or worktree Git configuration |
GitHub integration account | Identity and permissions used for issues, pull requests, and Actions | Explicit connected-account alias |
Changing git config user.email does not change the account used by a GitHub API Action. Switching Claude profiles does not change GitHub repository access. This guide is only about the third row.
If you also need separate Claude subscription profiles, start with How to Use Work and Personal Claude Code Accounts Safely. Keep that boundary independent from GitHub routing.
1. Verify that multi-account routing is available
Start with the canonical installation prompt:
Then check authentication and current connections:
Find the current GitHub integration rather than copying an internal identifier from an article:
Copy the exact integration identifier returned by discovery into a local variable:
Continue only when the live result exposes multiple-account controls such as canAddAccount: true. If it does not, do not manufacture an alias or reconnect the existing account under a different login. Keep one default account, use GitHub CLI's supported account switch for a human-controlled terminal job, or wait until the feature is available for your plan and integration.
2. Add the second account without replacing the first
Request an additional OAuth connection:
Open the returned connection URL yourself and sign in to the intended GitHub account. Do not paste a token, password, device code, or browser cookie into Claude Code. After OAuth completes, list the accounts again:
Expected result: both accounts are active and each has a distinct generated alias. If the second login replaced the first, the integration does not show two active accounts, or the provider identity is unclear, stop. Repeating the connection flow can make the ambiguity worse.
3. Rename aliases by purpose
Generated names such as Account 1 and Account 2 are easy to reverse. Rename them to the boundary that matters in review:
List the accounts after each rename. Use labels that describe ownership, not a provider email that might change. A client boundary can use Client Acme GitHub; a managed enterprise identity can use Work Enterprise GitHub.
Setting a default is optional. Defaults are convenient for one-account workflows, but a multi-account write should still name its alias explicitly. That makes the selected identity visible in the reviewed command.
4. Discover an identity check
Search for the current Action that returns the authenticated GitHub user:
Copy the exact Action name into a variable, then inspect its current contract:
Do not assume the schema is unchanged because an older run worked. Confirm that the Action needs no repository target, then run account-list again and confirm that it still includes the two aliases you reviewed. The provider operation retrieves profile information, but the live catalog may classify the Action conservatively as a write. Preserve the catalog's operation and risk metadata. If schema inspection returns no payload, stop instead of executing from the description alone.
5. Preflight once, execute once per alias
Validate the exact empty input before execution:
Continue only if the input is valid, the price is exact and inside your approved ceiling, and any catalog risk acknowledgement is understood and approved. Then run the same identity check once for each account:
For each result, compare the provider login with the expected human account and compare the execution receipt's account alias with the alias you requested.
Requested alias | Expected provider identity | Receipt alias | Decision |
|---|---|---|---|
| Your personal GitHub login |
| Pass only if both match |
| Your work or managed login |
| Pass only if both match |
If either result is ambiguous, stop before touching a repository. Do not infer identity from a repository name, local directory, SSH remote, or the last successful call.
6. Pin the alias on every repository Action
After the identity test passes, discover and inspect the exact GitHub Action for the job. Keep the same alias on pre-write reads and the eventual write:
The Action invocation must include:
Account selection is not write approval. For comments, labels, pull-request state changes, workflow dispatches, or merges, inspect the current schema, preflight the exact payload, obtain any required acknowledgement or human approval, execute once, and read the target back. Never use account routing to bypass branch protection or repository policy.
For a broader comparison of GitHub connection routes, read GitHub MCP Server vs Aident Loadout for Codex. For the credential boundary behind this workflow, continue to How to Give AI Agents API Access Without Exposing Keys.
Why explicit aliases beat hidden switching
GitHub documents that gh auth switch changes the active account used for a host. That is useful for an interactive terminal, but it is mutable process state. The next command depends on a prior switch succeeding and remaining active.
An Action-level account alias makes the routing choice part of the call under review. The operator can see the target, effect, and identity together. The receipt can report which connected alias was used. This does not eliminate credential or provider mistakes, but it gives the workflow a concrete invariant to verify.
Use this reusable Claude Code prompt:
Set up Aident and verify two GitHub account routes.
Questions people ask
Can Claude Code use two GitHub accounts at once?
Claude Code can call an integration layer that has two authorized GitHub connections, but each Action should select one exact account alias. "At once" should not mean one ambiguous shared identity.
Is this the same as gh auth switch?
No. GitHub CLI switches the active account for a host. Aident's account alias is supplied with the individual Action, so the route is explicit in the reviewed invocation and execution receipt.
Should I make my work account the default?
Only if most of your safe reads use it. Still include the alias on multi-account writes. A default is a convenience, not evidence that the correct identity was used.
What if Vault does not show canAddAccount: true?
Stop. Do not reconnect the default account or invent an unsupported switch. Use one connected identity or a different reviewed route until the live integration and your plan expose multiple-account controls.
Conclusion
Keep Claude identity, Git commit identity, and GitHub integration identity separate. Connect the second GitHub account only when the live Vault contract supports it, replace generic account numbers with ownership-based aliases, and prove each route with an authenticated-user identity check. Then attach the intended alias to every repository Action and preserve normal approval and readback gates for writes.
Sources
Anthropic Claude Code issue #27302: support multiple connector accounts
Live Aident Loadout catalog, Vault status, command help, and connected GitHub account-routing contract inspected September 3, 2026. The live account list showed one current default GitHub alias and support for adding and managing accounts; no second account was connected or changed during research.
Refresh this guide when Aident changes Vault multi-account fields, account-update commands, Action routing or receipt fields; GitHub changes multi-account authentication; or Claude adds native per-connector account selection that changes the comparison.
About the author
Aident AI
Related posts



The one tool
for every tool
your agent needs.
Give any AI agent real capabilities in seconds. Connect 27,000+ tools once, skip the setup headache, and let your agents execute.
