Gctx
Like kubectx but gitctx
Install / Use
/learn @kubeden/GctxREADME
gctx

A tiny CLI to switch git identities quickly (like kubectx/kns, but for git).
Install
./install.sh
Initialize profiles
gctx --init
List profiles (default):
gctx
If 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)
Usage
List profiles:
gctx --list
List profile names only (for scripting/completions):
gctx --profiles
Set default scope:
gctx --default-scope local
# or
gctx --local-default
gctx --global-default
Add a profile:
gctx --add work "Your Name" "you@work.com"
gctx --add personal "Your Name" "you@personal.com"
Switch globally (default):
gctx work
Switch per-repo:
gctx work --local
When 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
