A tiny CLI to switch git identities quickly (like kubectx/kns, but for git).
./install.shgctx --initList profiles (default):
gctxIf fzf is installed, running gctx will show an interactive picker (same
full-screen in-pane style as kubectx) and highlights the active profile.
Profiles are stored in ~/.config/gctx/profiles as:
profile|name|email|signingkey(optional)
List profiles:
gctx --listList profile names only (for scripting/completions):
gctx --profilesSet default scope:
gctx --default-scope local
# or
gctx --local-default
gctx --global-defaultAdd a profile:
gctx --add work "Your Name" "you@work.com"
gctx --add personal "Your Name" "you@personal.com"Switch globally (default):
gctx workSwitch per-repo:
gctx work --localWhen run inside a git repo, gctx <profile> will also rewrite origin to use
git@github-<profile>:OWNER/REPO.git (converts HTTPS remotes too), so the SSH key
is guaranteed to match the profile.
This relies on SSH host aliases in ~/.ssh/config, for example:
Host github-work
HostName github.com
User git
IdentityFile ~/.ssh/ssh-work
IdentitiesOnly yes
Host github-personal
HostName github.com
User git
IdentityFile ~/.ssh/ssh-personal
IdentitiesOnly yes
Check current identity:
gctx --current