Skip to content
$ gitswitch
Nord
★ star

Configuration

gitswitch stores configuration and user data in:

~/.config/gitswitch/
├── config.json # UI preferences, settings
├── profiles.json # Profile definitions
└── history.json # Repo usage history

Stores UI preferences and feature settings.

{
"theme": "Nord",
"nudge_on_cd": true,
"learning": {
"min_uses": 3,
"confidence_threshold": 0.6
}
}
FieldTypeDefaultDescription
themestring"Nord"Active color theme (see Themes section)
nudge_on_cdbooleantrueShow identity suggestions on cd
learning.min_usesnumber3Uses before nudging (min)
learning.confidence_thresholdnumber0.6Consistency %age before nudging

Available themes:

  • Nord
  • Dracula
  • Catppuccin
  • Tokyo Night
  • Gruvbox
  • One Dark
  • Solarized
  • Monokai
  • Material
  • Ayu Dark
  • Everforest
  • Synthwave

Change theme in TUI:

  • Press c to cycle through themes

Or edit config.json:

{
"theme": "Gruvbox"
}

Stores all profile definitions.

{
"profiles": [
{
"nickname": "personal",
"name": "Alice",
"email": "alice@gmail.com",
"sshKey": "~/.ssh/id_personal",
"gpgKey": "",
"githubUser": ""
},
{
"nickname": "work",
"name": "Alice Smith",
"email": "alice@company.com",
"sshKey": "~/.ssh/id_work",
"gpgKey": "1234567890ABCDEF",
"githubUser": "alice-work"
}
]
}

You can edit manually, but use the CLI when possible:

Terminal window
gitswitch add work "Name" email@example.com
gitswitch remove personal

Tracks which identity you use in each repo.

{
"/Users/alice/projects/work-repo": {
"work": 12,
"personal": 1
},
"/Users/alice/projects/personal-repo": {
"personal": 8
}
}

Used for:

  • Identity suggestions on cd
  • Learning which identity you prefer per-repo

Clear to reset learning:

Terminal window
rm ~/.config/gitswitch/history.json
Terminal window
export GITSWITCH_CONFIG_DIR=~/.gitswitch
gitswitch # Uses ~/.gitswitch instead of ~/.config/gitswitch

gitswitch reads/writes global git config:

Terminal window
~/.gitconfig

Keys modified:

  • user.name
  • user.email
  • user.signingkey (if GPG key set)
  • core.sshCommand (if SSH key set)

View active config:

Terminal window
git config --global --list

Or gitswitch:

Terminal window
gitswitch current

gitswitch expands paths:

  • ~ → home directory
  • $HOME → home directory
  • Absolute paths work as-is

Examples:

Terminal window
gitswitch add work "Alice" alice@company.com \
--ssh-key ~/.ssh/id_work # Expands to /Users/alice/.ssh/id_work
--ssh-key $HOME/.ssh/id_work # Same
--ssh-key /Users/alice/.ssh/id_work # Absolute path

gitswitch uses GPG key IDs from your keyring:

Terminal window
# List available keys
gpg --list-secret-keys --keyid-format LONG
# Setup profile
gitswitch add work "Alice" alice@company.com \
--gpg-key 1234567890ABCDEF

The key must exist in your keyring. If not found, gitswitch will warn but still create the profile (in case you add the key later).

All gitswitch data is in ~/.config/gitswitch/:

Terminal window
# Backup
cp -r ~/.config/gitswitch ~/backups/gitswitch-backup
# Restore
cp -r ~/backups/gitswitch-backup ~/.config/gitswitch
Error: config directory not found

Create it:

Terminal window
mkdir -p ~/.config/gitswitch
gitswitch init
Error: failed to read config: permission denied

Check permissions:

Terminal window
ls -la ~/.config/gitswitch/
chmod 700 ~/.config/gitswitch
chmod 600 ~/.config/gitswitch/*.json

If you edit profiles.json manually, ensure valid JSON:

Terminal window
cat ~/.config/gitswitch/profiles.json | jq .
# Should not show errors
Error: ssh key not found

Check path:

Terminal window
ls -la ~/.ssh/id_work
# If not found, the path is wrong or key doesn't exist

CLI Reference
Profiles
Quick Start