// docs
Features

gh CLI Isolation

Give every terminal its own GitHub CLI account, without fighting over gh's single global active account

Canary channel. This feature ships in gitswitch's canary builds. Run gitswitch beta to switch your install to canary (gitswitch stable switches back at any time).

The problem

gh (the GitHub CLI) only tracks one "active" account for your whole machine. Switching your gitswitch identity in one terminal silently flips which account every other open terminal's bare gh commands (gh pr create, gh issue list, gh repo view, ...) use too — even in a completely unrelated repo.

What it does

Turning on "gh CLI Isolation" installs a gh shell function that wraps the real gh binary. Before every gh invocation, the wrapper resolves the right GitHub account for the repo you're in — the same resolution the HTTPS credential helper uses for pushes — and passes that account's token via GH_TOKEN for just that one command. gh's own global "active account" file is never read or written, so concurrent terminals never fight over it.

Enable it

Open the TUI and go to the Utilities tab:

gitswitch

Toggle gh CLI Isolation on, then reload your shell (or open a new terminal) to pick up the wrapper.

How account resolution works

For each gh call, the wrapper works out which profile applies to the current repo — your global identity, a pinned repo, or a session override — and fetches that profile's stored token. If no account resolves (no gh-linked profile, or you're outside a git repo), the wrapper falls through to plain gh using your existing global account — no change in behavior.

Turn it off

Toggle "gh CLI Isolation" off in the Utilities tab, or run gitswitch uninstall to remove all shell integration at once. Either way the wrapper function is removed immediately and bare gh behaves exactly like it did before.

Troubleshooting

gh commands still use the wrong account after enabling

The wrapper is a shell function — a terminal opened before you turned the toggle on won't have it until its rc file is re-sourced:

source ~/.zshrc    # zsh
source ~/.bashrc   # bash
# or open a new terminal

Isolation seems to do nothing

The wrapper overrides the token used for a given call — it doesn't change what gh auth status reports, since that command reads gh's own global account list, which isolation intentionally never touches. Judge it by which account a gh command actually acted as, not by gh auth status.

Next steps

On this page