A tiny CLI for macOS/Linux that manages multiple git identities and SSH keys,
and makes it easy to bind a specific account/key to a specific local repo so
push/pull/fetch "just work" with the right credentials.
No dependencies beyond bash, git, and ssh-keygen (all pre-installed on
macOS and virtually every Linux distro).
Each "account" you register (e.g. work, personal, client-x) has its own:
- full name + email → used for commit authorship
- SSH key → used for authentication
Running multigit use <name> inside a repo sets, locally to that repo only:
user.name/user.emailcore.sshCommand→ pins that repo to the account's specific key withIdentitiesOnly=yes
That means every repo can use a different identity/key automatically, with no
global SSH config, no ssh-agent juggling, and no risk of accidentally
pushing to a client's repo with your personal key.
curl -fsSL https://raw.githubusercontent.com/turbostartdev/multigit/main/install.sh | bashThis downloads multigit, installs it to /usr/local/bin/multigit, and
verifies it's on your PATH. It uses sudo to write to /usr/local/bin,
so it will prompt for your password once up front (before anything is
downloaded) — nothing runs with elevated privileges beyond that single
install step.
# 1. copy the script onto your PATH
sudo cp multigit /usr/local/bin/multigit
sudo chmod +x /usr/local/bin/multigit
# 2. verify
multigit help/usr/local/bin is on PATH by default on macOS and virtually every Linux
distro, so no shell profile changes are usually needed. If you'd rather
install without sudo, copy it to ~/bin instead and make sure that's on
your PATH.
Config and generated keys are stored under ~/.multigit/ (override with the
MULTIGIT_HOME env var).
Remove any config that points to your git service provider host on ~/.ssh/config file.
multigit add workYou'll be prompted for a full name, email, and either an existing SSH key
path or nothing (in which case a new ed25519 key pair is generated for you
under ~/.multigit/keys/). At the end it prints the public key — copy it into
your git host's SSH key settings (e.g. github.com/settings/keys).
Repeat for as many accounts as you need:
multigit add personal
multigit add client-xcd ~/code/work-project
multigit use workThis sets local git config so all git network operations in this repo use
the work identity and key. Other repos are untouched.
multigit test workRuns ssh -T git@<host> with that account's key so you can confirm the key
is registered with your git host before you try to push anything.
multigit currentmultigit clone personal git@github.com:me/side-project.gitClones the repo and immediately runs multigit use personal inside it.
multigit push origin main
multigit pullThese are thin wrappers around git push/git pull — you can just use
git push/git pull directly too, since the key is already wired in via
core.sshCommand. The wrappers just warn you if the current repo has no
multigit account set yet.
| Command | Description |
|---|---|
multigit add <name> |
Register a new account (interactive) |
multigit gen-key <name> |
Generate a fresh key for an existing account (backs up the old one) |
multigit list |
List all registered accounts |
multigit show <name> |
Show one account's details |
multigit remove <name> |
Remove an account (key files kept on disk) |
multigit use <name> |
Bind an account to the current repo |
multigit current |
Show which account the current repo uses |
multigit test <name> |
Test SSH auth for an account |
multigit clone <name> <url> [dir] |
Clone a repo and bind the account immediately |
multigit push [args] |
git push wrapper |
multigit pull [args] |
git pull wrapper |
- HTTPS remotes:
multigit useonly affects SSH-based git operations. If youroriginis anhttps://URL, the key won't be used —multigit usewill warn you about this. Use an SSH remote URL (git@github.com:user/repo.git) to take advantage of per-repo keys. - Multiple accounts on the same host (e.g. two GitHub accounts): this
works fine because auth is pinned by key file, not by SSH
Hostalias — you don't need to rewrite remote URLs or maintain~/.ssh/configentries. - Removing an account (
multigit remove) only removes it from multigit's registry; it does not delete the key files or touch any repo that already hascore.sshCommandset — that repo will just keep working exactly as before until youmultigit usea different account there.