Live demo

See it in action

Watch how git-profile-switcher intercepts a git push and lets you pick which GitHub account to use — in real time.

git-profile-switcher — demo
STEP 01
git push triggered
The switcher intercepts the command before git.exe ever runs.
STEP 02
Account picker appears
Lists all your configured profiles. You pick the one you want.
STEP 03
Pushed with right identity
SSH key and git identity injected automatically. Done.
Terminal walkthrough

Every scenario, step by step

PowerShell — any folder
PS ~/projects/my-app ❯ git push origin main
+-------------------------------+
| Which Git account? |
+-------------------------------+
[1] personal (your-username)
[2] work (work-username)
-> Enter number (default 1): 2
[OK] Using -> work (Jane Doe <jane@company.com>)
Writing objects: 100% (3/3), done.
To git@github-work:work-username/my-app.git
abc1234..def5678 main -> main
The picker appears every time. SSH key and identity are injected per-command — your global ~/.gitconfig is never touched.
PowerShell — any folder
PS ~/projects/my-app ❯ git commit -m "feat: add login page"
+-------------------------------+
| Which Git account? |
+-------------------------------+
[1] personal (your-username)
[2] work (work-username)
-> Enter number (default 1): 1
[OK] Using -> personal (Your Name <you@gmail.com>)
[main abc1234] feat: add login page
3 files changed, 120 insertions(+)
Commits are tagged with the right author name and email automatically — no more wrong identity in your git log.
PowerShell — HTTPS remote
PS ~/projects/new-repo ❯ git remote add origin https://github.com/work-username/new-repo.git
PS ~/projects/new-repo ❯ git push -u origin main
+-------------------------------+
| Which Git account? |
+-------------------------------+
[1] personal (your-username)
[2] work (work-username)
-> Enter number (default 1): 2
[OK] Remote converted to SSH automatically
[OK] Using -> work (Jane Doe <jane@company.com>)
Writing objects: 100% (3/3), done.
To git@github-work:work-username/new-repo.git
Paste the normal GitHub HTTPS URL — the switcher detects it and converts to SSH automatically based on the account you pick. No manual SSH URL needed.
PowerShell — first time setup
PS ~/git-profile-switcher ❯ PowerShell -ExecutionPolicy Bypass -File scripts\setup-git-profiles.ps1
============================================================
git-profile-switcher - Setup
============================================================
Profile 1
Label (e.g. personal / work): personal
Git name (e.g. Jane Doe): Your Name
Git email (e.g. jane@gmail.com): you@gmail.com
GitHub username: your-username
SSH key name: id_ed25519_personal
[OK] Profile 'personal' saved
Add another profile? [y/N]: y
...
[OK] SSH keys generated
[OK] SSH config updated
[OK] Switcher installed
[OK] Shell profile injected
Setup complete! Restart your terminal.
The setup script handles everything — SSH key generation, SSH config, shell integration. Run it once and you're done forever. Re-run anytime to add, edit, or delete profiles.
Why it works

Under the hood

Simple, transparent, no magic.

Shell function wrapper
The git command is replaced with a shell function that intercepts trigger commands and calls git.exe with the right flags after you pick.
🔑
GIT_SSH_COMMAND per-call
SSH key selection happens via GIT_SSH_COMMAND environment variable — scoped to each command, not globally. No key conflicts.
👤
-c flags for identity
user.name and user.email are passed as -c flags directly to git.exe. Your global ~/.gitconfig is never modified.
🔁
HTTPS → SSH conversion
Remote URL is checked with git remote get-url. If it's HTTPS, it's rewritten to git@github-{label}:user/repo.git before the push.
Open source · Free forever

Try it yourself

One script. One restart. Never push to the wrong account again.