A terminal UI for toggling between git and GitHub identities. Run it in any repo to see your current git user, SSH key, and GitHub account — then switch to a different profile with a single keystroke.
When you run git-switcher inside a git repository, it:
- Reads your profiles from
~/.config/git-switcher/config.toml - Detects the repo's current identity (git user, SSH key,
ghaccount) - Shows a dashboard with the current state and your available profiles
- On selection, sets the local git config, SSH key, and active
ghaccount
go install github.com/dankozlowski/git-switcher@latestOr build from source:
git clone https://github.com/dankozlowski/git-switcher.git
cd git-switcher
go build -o git-switcher .Create ~/.config/git-switcher/config.toml:
[[profiles]]
name = "personal"
git_name = "Your Name"
git_email = "you@example.com"
ssh_key = "~/.ssh/id_ed25519"
gh_user = "yourgithub"
[[profiles]]
name = "work"
git_name = "Your Work Name"
git_email = "you@work.com"
ssh_key = "~/.ssh/work_key"
gh_user = "your-work-github"Each profile needs:
| Field | Description |
|---|---|
name |
Display label for the profile |
git_name |
Value for user.name |
git_email |
Value for user.email |
ssh_key |
Path to SSH private key (~ is expanded) |
gh_user |
GitHub username for gh auth switch |
cd your-repo
git-switcherNavigate with arrow keys (or j/k), press Enter to switch, q to quit.
When you switch profiles, git-switcher runs:
git config --local user.name "..."
git config --local user.email "..."
git config --local core.sshCommand "ssh -i <key> -o IdentitiesOnly=yes"
gh auth switch --user <gh_user>
If gh isn't installed or the account isn't logged in, git and SSH settings are still applied — you'll see a warning for the gh step.
If using gh, authenticate both accounts first:
gh auth login # first account
gh auth login # second accountgit-switcher/
├── main.go Entry point, pre-flight checks, launches TUI
├── config.go Config file parsing (TOML)
├── detector.go Reads current repo state (git config, SSH, gh)
├── switcher.go Applies a profile (git config, SSH, gh commands)
├── tui.go Bubbletea model, view, update
├── *_test.go Tests for config, detector, and switcher
├── go.mod
└── go.sum
- Bubble Tea — TUI framework
- Lip Gloss — Terminal styling
- BurntSushi/toml — TOML parser
go test -v ./...- Charm for Bubble Tea and Lip Gloss — the Go TUI ecosystem that makes terminal apps a pleasure to build
- BurntSushi for the rock-solid TOML parser
- GitHub CLI for making multi-account switching possible from the command line
MIT