A beautiful TUI to switch between Git profiles (personal/work) on macOS.
- Pretty terminal UI with Charm Bracelet
- Keeps your emails private (config.yaml is gitignored)
- Switches both SSH config and Git user config
- GPG key signing support per profile
- Easy keyboard navigation
go install github.com/lutefd/p-switch@latestThen run p-switch once to generate the config file at ~/.config/p-switch/config.yaml, edit it with your details, and run again!
git clone https://github.com/lutefd/p-switch.git
cd p-switch
go build -o p-switch
chmod +x p-switch
sudo ln -sf $(pwd)/p-switch /usr/local/bin/p-switchOn first run, p-switch will create ~/.config/p-switch/config.yaml for you. Edit it with your details:
profiles:
personal:
name: "Your Name"
email: "your.personal@email.com"
sshIdentityFile: "~/.ssh/personal"
gpgKey: "" # GPG key ID for commit signing (optional, leave empty to disable)
work:
name: "Your Name"
email: "your.work@email.com"
sshIdentityFile: "~/.ssh/work"
gpgKey: "ABC123" # GPG key ID for commit signing (optional, leave empty to disable)
sshConfigPath: "~/.ssh/config"p-switchUse arrow keys or j/k to navigate, Enter to select, q to quit.
p-switch --edit # Opens config in $EDITOR (defaults to vim)p-switch --config # Prints: ~/.config/p-switch/config.yamlOr just edit directly:
vim ~/.config/p-switch/config.yamlWhen you select a profile, p-switch will:
- Update your
~/.ssh/configto use the correct IdentityFile forgithub.com - Update your global git config for
user.emailanduser.name - Configure GPG commit signing if a
gpgKeyis set (or disable it if empty)
Note: p-switch sets global git config. Local repo-level config (
.git/config) will take precedence over these settings.