Configuration
Configuration file
Section titled “Configuration file”gitswitch stores configuration and user data in:
~/.config/gitswitch/├── config.json # UI preferences, settings├── profiles.json # Profile definitions└── history.json # Repo usage historyconfig.json
Section titled “config.json”Stores UI preferences and feature settings.
{ "theme": "Nord", "nudge_on_cd": true, "learning": { "min_uses": 3, "confidence_threshold": 0.6 }}Fields
Section titled “Fields”| Field | Type | Default | Description |
|---|---|---|---|
theme | string | "Nord" | Active color theme (see Themes section) |
nudge_on_cd | boolean | true | Show identity suggestions on cd |
learning.min_uses | number | 3 | Uses before nudging (min) |
learning.confidence_threshold | number | 0.6 | Consistency %age before nudging |
Themes
Section titled “Themes”Available themes:
NordDraculaCatppuccinTokyo NightGruvboxOne DarkSolarizedMonokaiMaterialAyu DarkEverforestSynthwave
Change theme in TUI:
- Press
cto cycle through themes
Or edit config.json:
{ "theme": "Gruvbox"}profiles.json
Section titled “profiles.json”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:
gitswitch add work "Name" email@example.comgitswitch remove personalhistory.json
Section titled “history.json”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:
rm ~/.config/gitswitch/history.jsonEnvironment variables
Section titled “Environment variables”Custom config directory
Section titled “Custom config directory”export GITSWITCH_CONFIG_DIR=~/.gitswitchgitswitch # Uses ~/.gitswitch instead of ~/.config/gitswitchIntegration with git config
Section titled “Integration with git config”gitswitch reads/writes global git config:
~/.gitconfigKeys modified:
user.nameuser.emailuser.signingkey(if GPG key set)core.sshCommand(if SSH key set)
View active config:
git config --global --listOr gitswitch:
gitswitch currentSSH key paths
Section titled “SSH key paths”gitswitch expands paths:
~→ home directory$HOME→ home directory- Absolute paths work as-is
Examples:
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 pathGPG key configuration
Section titled “GPG key configuration”gitswitch uses GPG key IDs from your keyring:
# List available keysgpg --list-secret-keys --keyid-format LONG
# Setup profilegitswitch add work "Alice" alice@company.com \ --gpg-key 1234567890ABCDEFThe key must exist in your keyring. If not found, gitswitch will warn but still create the profile (in case you add the key later).
Backup configuration
Section titled “Backup configuration”All gitswitch data is in ~/.config/gitswitch/:
# Backupcp -r ~/.config/gitswitch ~/backups/gitswitch-backup
# Restorecp -r ~/backups/gitswitch-backup ~/.config/gitswitchTroubleshooting
Section titled “Troubleshooting”Config not found
Section titled “Config not found”Error: config directory not foundCreate it:
mkdir -p ~/.config/gitswitchgitswitch initCan’t read config file
Section titled “Can’t read config file”Error: failed to read config: permission deniedCheck permissions:
ls -la ~/.config/gitswitch/chmod 700 ~/.config/gitswitchchmod 600 ~/.config/gitswitch/*.jsonProfile not found after editing
Section titled “Profile not found after editing”If you edit profiles.json manually, ensure valid JSON:
cat ~/.config/gitswitch/profiles.json | jq .# Should not show errorsSSH key not found
Section titled “SSH key not found”Error: ssh key not foundCheck path:
ls -la ~/.ssh/id_work# If not found, the path is wrong or key doesn't existNext steps
Section titled “Next steps”→ CLI Reference
→ Profiles
→ Quick Start