A beautiful cross-platform CLI tool to manage multiple GitHub accounts on the same machine. Switch between personal, work, and client accounts effortlessly with arrow key navigation, automatic SSH key management, smart remote URL updates, automatic backups, and global git config switching.
- π¨ Beautiful TUI - Arrow key navigation, no typing needed
- β‘ Fast Switching - Change accounts in seconds
- π Global & Local Switching - Switch globally (all repos) or locally (current repo)
- π Auto SSH Setup - Generates keys and configures everything
- π Smart URL Updates - Automatically fixes remote URLs
- πΎ Persistent Config - Remembers all your accounts
- π― Repo Detection - Knows when you're in a git repository
- π₯οΈ Cross-Platform - Works on Linux, macOS, and Windows
- π¦ Zero Dependencies - Single Python script, no pip install needed
- π Auto Backups - Config backed up before every change
Select Account - LOCAL switch (current repo only):
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β personal john@personal.com
work john@work.com
client1 john@client1.com
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β/β Navigate Enter Select q Cancel
Select Account - GLOBAL switch (affects all repos):
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β personal john@personal.com
work john@work.com
client1 john@client1.com
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β/β Navigate Enter Select q Cancel
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Git Account Manager v1.1 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β In git repository
Account: personal
Current: John Doe <john@personal.com>
Quick Actions:
s. Switch account (arrow key selection)
w. Show status (who am I?)
Account Management:
l. List all accounts
a. Add account
e. Edit account
r. Remove account
Backup:
b. Show backup info
R. Restore from backup
q. Exit
# Download and install
curl -o ~/bin/gitman https://raw.githubusercontent.com/oxzoid/gitman/main/gitman
chmod +x ~/bin/gitman
# Add ~/bin to PATH if not already there
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# Or for zsh
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc# Create bin directory
mkdir -p ~/bin
# Download the script (or copy-paste the code)
nano ~/bin/gitman
# Paste the gitman code, save with Ctrl+O, Enter, Ctrl+X
# Make executable
chmod +x ~/bin/gitman
# Add to PATH
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcgitman help# In Git Bash
mkdir -p ~/bin
curl -o ~/bin/gitman https://raw.githubusercontent.com/oxzoid/gitman/main/gitman
chmod +x ~/bin/gitman
# Add to PATH
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# Verify
gitman help# Create directory
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\bin"
# Download the script
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/oxzoid/gitman/main/gitman" -OutFile "$env:USERPROFILE\bin\gitman.py"
# Create wrapper batch file
$batchContent = @"
@echo off
python "%USERPROFILE%\bin\gitman.py" %*
"@
Set-Content -Path "$env:USERPROFILE\bin\gitman.bat" -Value $batchContent
# Add to PATH (User level - no admin needed)
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($currentPath -notlike "*$env:USERPROFILE\bin*") {
[Environment]::SetEnvironmentVariable("Path", "$currentPath;$env:USERPROFILE\bin", "User")
}
# Restart PowerShell, then verify
# Close and reopen PowerShell
gitman help# Save the script anywhere
python C:\path\to\gitman.py help
# Or add an alias
doskey gitman=python C:\path\to\gitman.py $*- Python 3.6+ (Download from python.org)
- Git for Windows (includes OpenSSH) - Download
- OpenSSH Client (Windows 10+ has it built-in, or comes with Git)
Run the setup wizard - it does everything for you:
gitman setupThis will:
- β Ask for your account details
- β Generate SSH keys automatically
- β Configure SSH hosts
- β Add keys to ssh-agent
- β Show you the public key to add to GitHub
- β Test the connection
Just follow the prompts and paste the public key to GitHub!
gitman add
# Choose option 2 for auto-setup# In any git repository
gitman
# Use arrow keys to select account
# Press Enter to switch (affects current repo only)# From anywhere (even outside a repo)
gitman switch --global
# Or use the short flag
gitman s -g
# Use arrow keys to select account
# Press Enter to switch (affects all repos globally)# Switch current repo to personal
gitman switch personal
# Switch globally to work account
gitman switch work --globalgitman setup # Complete setup wizard (first time)
gitman # Quick switch (local if in repo, global if not)
gitman status # Show current git identity
gitman switch # Switch with arrow keys (context-aware)
gitman switch --global # Switch globally with arrow keys
gitman switch <account> # Switch to specific account (local)
gitman switch <account> --global # Switch to specific account (global)
gitman list # List all accounts
gitman add # Add new account
gitman remove # Remove account (arrow keys)
gitman remove <account> # Remove specific account
gitman backup # Show backup information
gitman restore # Restore from backup
gitman help # Show help
gitman edit # Edit account (arrow keys)
gitman edit <account> # Edit specific account
gitman clone Show clone URLs for all accounts
gitman clone <account> Show clone URL for specific accountgitman who # Same as 'status'
gitman s # Same as 'switch'
gitman s -g # Same as 'switch --global'
gitman ls # Same as 'list'
gitman l # Same as 'list'
gitman a # Same as 'add'
gitman rm <account> # Same as 'remove'
gitman r # Same as 'remove'
gitman e # Same as 'edit'
gitman c #Same as 'cloneWhen in the TUI (run gitman without arguments outside a repo):
s- Switch accountw- Show status (who am I?)l- List all accountsa- Add accountr- Remove accountb- Show backup infoR- Restore from backup (capital R)q- Quite- Edit account
When: You're in a git repository and want to change the identity for that repo only.
cd ~/my-project
gitman switch personal # Only affects this repoResult:
- Sets
git config user.nameanduser.emailfor current repo - Updates remote URL to use correct SSH host
- Other repos remain unchanged
When: You want to set your default identity for all new repos and repos without local config.
# From anywhere
gitman switch work --globalResult:
- Sets
git config --global user.nameanduser.email - Affects all future repos and repos without local settings
- Useful before cloning repos or starting new projects
# Inside a repo: local switch
cd ~/my-repo
gitman # β Shows "LOCAL switch (current repo only)"
# Outside a repo: global switch
cd ~
gitman # β Shows "GLOBAL switch (affects all repos)"# Set global to work account (for cloning work repos)
gitman switch work --global
# Clone work repo (uses work SSH key and identity)
git clone git@github.com-work:company/project.git
cd project
# Verify identity
gitman status
# β Shows work account
# Switch to personal for a quick fix in personal repo
cd ~/personal-project
gitman switch personal # Local switch, doesn't affect global
# Clone another work repo (still uses global work account)
cd ~
git clone git@github.com-work:company/another-project.git# Set default to personal
gitman switch personal --global
# Working on client A's project
cd ~/clients/clientA/project
gitman switch clientA # Local switch
# Working on client B's project
cd ~/clients/clientB/project
gitman switch clientB # Local switch
# Back to personal projects (uses global)
cd ~/personal/my-app
gitman status
# β Shows personal account (from global)# Set global to work (default for all work)
gitman switch work --global
# All work repos automatically use work account
git clone git@github.com-work:company/repo1.git
git clone git@github.com-work:company/repo2.git
git clone git@github.com-work:company/repo3.git
# Quick personal contribution (local override)
cd ~/open-source/some-library
gitman switch personal # Just for this repo
# Back to work
cd ~/company/repo1
gitman status
# β Uses work account (from global)gitman automatically backs up your config before every change (add/remove accounts). Only one backup version is kept.
# Show what's in the backup
gitman backup
# Restore from backup (with preview and confirmation)
gitman restore~/.gitmanager/
βββ config.json # Current config
βββ backups/
βββ config.backup.json # Last backup
βββ config.temp.json # Temporary safety backup
- Auto-backup: Before adding/removing accounts, current config is saved
- Single version: Only the most recent backup is kept (no clutter)
- Safe restore: Shows preview of both backup and current config before restoring
- Safety net: Creates a temp backup of current config before restoring
~/.gitmanager/
βββ config.json # Account configurations
βββ backups/
βββ config.backup.json # Backup
~/.ssh/
βββ config # SSH host configurations
βββ id_ed25519_personal # Personal private key
βββ id_ed25519_personal.pub # Personal public key
βββ id_ed25519_work # Work private key
βββ id_ed25519_work.pub # Work public key
βββ ...
~/bin/
βββ gitman # The script
C:\Users\YourName\.gitmanager\
βββ config.json # Account configurations
βββ backups\
βββ config.backup.json # Backup
C:\Users\YourName\.ssh\
βββ config # SSH host configurations
βββ id_ed25519_personal # Personal private key
βββ id_ed25519_personal.pub # Personal public key
βββ id_ed25519_work # Work private key
βββ id_ed25519_work.pub # Work public key
βββ ...
C:\Users\YourName\bin\
βββ gitman.py # The script
# 1. Install gitman
curl -o ~/bin/gitman https://raw.githubusercontent.com/oxzoid/gitman/main/gitman
chmod +x ~/bin/gitman
# 2. Setup personal account
gitman setup
# Answer prompts:
# - Account name: personal
# - Display name: John Doe
# - Email: john@personal.com
# - GitHub username: johndoe
# Copy the SSH key to GitHub
# 3. Setup work account
gitman add
# Choose option 2 (auto-setup)
# - Account name: work
# - Display name: John Doe
# - Email: john@company.com
# - GitHub username: johndoe-work
# Copy the SSH key to GitHub
# 4. Set global default to work (for daily work)
gitman switch work --global
# 5. Clone a work project (automatically uses work account)
git clone git@github.com-work:company/project.git
cd project
# 6. Verify identity
gitman status
# Shows: work account
# 7. Quick personal project
cd ~/personal/my-app
gitman switch personal # Local override
# 8. Verify
gitman status
# Shows: personal account
# 9. Commit and push
git add .
git commit -m "Update feature"
git push
# Uses personal account identity!
# 10. Back to work project
cd ~/work/company-project
gitman status
# Shows: work account (from global)If you prefer to set up SSH manually instead of using auto-setup:
# Personal account
ssh-keygen -t ed25519 -C "personal@email.com" -f ~/.ssh/id_ed25519_personal
# Work account
ssh-keygen -t ed25519 -C "work@email.com" -f ~/.ssh/id_ed25519_worknano ~/.ssh/configAdd:
# Personal GitHub Account
Host github.com-personal
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_personal
IdentitiesOnly yes
# Work GitHub Account
Host github.com-work
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_work
IdentitiesOnly yes
# Copy personal key
cat ~/.ssh/id_ed25519_personal.pub
# Copy work key
cat ~/.ssh/id_ed25519_work.pubGo to GitHub β Settings β SSH and GPG keys β New SSH key
gitman add
# Choose option 1 (manual setup)ssh -T git@github.com-personal
ssh -T git@github.com-workExpected: Hi username! You've successfully authenticated...
Each account uses a unique SSH host alias:
github.com-personalβ Uses personal SSH keygithub.com-workβ Uses work SSH keygithub.com-client1β Uses client1 SSH key
gitman intelligently manages git config based on context:
Local Switch (in a repo):
cd ~/my-repo
gitman switch personal
# Sets (repository-level):
# git config user.name "John Doe"
# git config user.email "john@personal.com"Global Switch (anywhere):
gitman switch work --global
# Sets (system-wide):
# git config --global user.name "John Doe"
# git config --global user.email "john@company.com"When switching accounts in a repo, gitman automatically updates remote URLs:
# Before: git@github.com-work:user/repo.git
gitman switch personal
# After: git@github.com-personal:user/repo.gitThis ensures pushes use the correct SSH key!
| Feature | gitman | Manual | Git Config | Other Tools |
|---|---|---|---|---|
| Visual UI | β Arrow keys | β CLI only | β CLI only | |
| Global switching | β Yes | β Yes | β Yes | |
| Local switching | β Yes | β Yes | β Yes | |
| Auto SSH setup | β Yes | β Manual | β Manual | |
| Remote URL fix | β Automatic | β Manual | β Manual | |
| Auto backups | β Yes | β No | β No | |
| Cross-platform | β Win/Mac/Linux | β Yes | β Yes | |
| Zero dependencies | β Just Python | β Just Git | β Just Git | β Need packages |
| Account storage | β Persistent | β Remember | β Scripts | |
| Context awareness | β Smart detection | β Manual | β Manual |
Solution: Navigate to a git repository or use global switch.
# Either:
cd ~/your-project
gitman switch personal
# Or:
gitman switch personal --globalSolution: List and add accounts.
gitman list # See available accounts
gitman add # Add new accountCheck local (current repo):
git config user.emailCheck global (system-wide):
git config --global user.emailCheck effective (what will be used):
git config --show-origin user.emailProblem: Remote URL stays the same after switching. Solution: Check SSH config has the correct host.
cat ~/.ssh/config
# Should have entries like:
# Host github.com-personal
# HostName github.com
# ...Problem: ssh -T git@github.com-personal fails
Solutions:
- Check SSH key is added to GitHub
- Verify SSH config syntax
- Ensure ssh-agent is running
- Check key permissions (should be 600)
# Start ssh-agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519_personal
# Fix permissions
chmod 600 ~/.ssh/id_ed25519_personal
chmod 644 ~/.ssh/id_ed25519_personal.pub
chmod 600 ~/.ssh/configSolution: Install Git for Windows or OpenSSH.
- Git for Windows: https://git-scm.com/download/win
- Or enable OpenSSH in Windows Features
On Windows CMD/PowerShell: Use Git Bash or Windows Terminal instead. On Linux: Check if terminal supports ANSI escape sequences.
Solution: Use Windows Terminal or Git Bash instead of old CMD.
# Install Windows Terminal (recommended)
winget install Microsoft.WindowsTerminalProblem: python3: command not found
Solution: Use python instead, or install Python 3.6+
# Check version
python --version
python3 --version
# If needed, download from python.orgSolution: Restore from automatic backup
# Check what's in the backup
gitman backup
# Restore with confirmation
gitman restoreUse descriptive account names:
- β
personal,work,freelance,client-acme - β
acc1,test,temp
Choose your most-used account as global default:
# If you mostly work on company projects
gitman switch work --global
# If you mostly work on personal projects
gitman switch personal --globalAlways clone using the appropriate SSH host:
# Personal projects
git clone git@github.com-personal:username/repo.git
# Work projects
git clone git@github.com-work:username/repo.gitGet in the habit of checking your identity:
cd ~/project
gitman status # Quick check
git commit -m "..." # Now commit safelyIf your global is set to work, but you need to contribute to an open-source project:
cd ~/open-source/some-library
gitman switch personal # Local override, doesn't affect other reposFor freelancers with many clients:
gitman add # client-acme
gitman add # client-techcorp
gitman add # client-startup
# Each gets its own SSH key and config
# Set a default for new projects
gitman switch freelance --global# Backup SSH keys
cp -r ~/.ssh ~/backup-ssh-$(date +%Y%m%d)
# Backup gitman config
cp ~/.gitmanager/config.json ~/backup-gitman-$(date +%Y%m%d).jsonNote: gitman automatically backs up config before changes, but manual backups of SSH keys are still recommended.
Contributions welcome! Feel free to:
- Report bugs
- Suggest features
- Submit pull requests
- Improve documentation
MIT License - feel free to use and modify
Created by oxzoid for developers managing multiple GitHub accounts efficiently.
Yes! Run gitman switch <account> in any repo to update its identity and remote URL.
Absolutely! Add as many as you need - personal, work, clients, open source, etc.
Only when you explicitly use --global flag. Local switches only affect the current repository.
- Local: Changes identity for current repo only (
git config user.name) - Global: Changes identity for all repos system-wide (
git config --global user.name)
- Global: Set your default identity for most projects (e.g., work account for a company developer)
- Local: Override for specific repos (e.g., personal contribution to open-source while at work)
Yes! Use gitman switch --global or gitman switch <account> --global.
The setup wizard will detect them and offer to use existing keys or generate new ones.
gitman is designed for SSH key management. For HTTPS, you'd need to use Git credential managers instead.
Use gitman restore to recover from the automatic backup created before the deletion.
Use gitman status to see current identity, or:
# Check local
git config user.email
# Check global
git config --global user.email
# Check effective (what will be used)
git config --show-origin user.emailMade with β€οΈ for developers juggling multiple GitHub accounts
If this tool helped you, give it a β on GitHub!