git-userhub
v3.1.1
Published
Switch Git accounts in one command. No config editing. No SSH key chaos.
Downloads
3,052
Maintainers
Readme
Note on the package name: This package is published as
git-userhubon npm. After installation, the CLI command isgit-user. The npm name is just the registry identifier — everything you run isgit-user.
Install
npm install -g git-userhubThat's it. The git-user command is now available in your terminal.
The Problem It Solves
You have a work account, a personal account, maybe a freelance client or two. Every few weeks you push commits with the wrong email. Your personal address ends up in a client's repo history. Your work email leaks onto your public GitHub profile.
git-user fixes this permanently. Register your identities once, switch with one command.
Quick Start
# Register your identities (guided, takes ~2 minutes each)
git-user register # name: work, email: [email protected]
git-user register # name: personal, email: [email protected]
# Switch between them instantly
git-user switch work
git-user switch personal
# See what's active
git-user current
# Create and switch in one step
git-user switch -c freelance [email protected]What It Does on Switch
git-user switch work
│
▼
1. Reads "work" from ~/.git-users/config.json
2. Sets ~/.gitconfig → user.name, user.email
3. Sets ~/.gitconfig → core.sshCommand (your SSH key)
4. Verifies SSH connection
5. ✅ Done — under one secondKey Features
| Feature | Description |
|---------|-------------|
| 🔑 Identity switching | Name + email + SSH key as one atomic unit |
| 🔐 SSH key management | Auto-generate ed25519 keys, bind existing keys, pubkey shows active key only |
| 🔒 Temporary sessions | Use an identity on a shared machine — zero trace left behind |
| 🛡️ Security audit | git-user security checks permissions and passphrase protection |
| 🚀 HTTPS → SSH | git-user fix-remote converts remotes for passwordless push |
| 🪝 Pre-commit hooks | Block commits if the wrong identity is active |
| 📦 Export/import | Move all identities to a new machine, AES-256 encrypted |
| 🖥️ TUI | Interactive menu for everything |
| 🐚 Shell completions | bash, zsh, fish |
Temporary Sessions
Working on a borrowed machine? Don't want to leave SSH keys behind?
# Start a temporary session — nothing is saved permanently
git-user session start --temp alice [email protected] --ttl 2h
# When done — key files deleted, previous identity restored
git-user session stopAll Commands
register Create new identity (guided)
switch <name> Switch to an identity
switch -c <name> [email] Create and switch in one step
list Show all identities
current Show active identity
remove <name> Delete an identity
edit <name> <email> Update email
bind <name> Link an SSH key
pubkey Show public key of active identity
passphrase Add, change, or remove (--remove) passphrase for active identity
rekey <name> Rotate SSH key
fix-remote Convert HTTPS remotes to SSH
session start [--ttl <d>] Load SSH key into ssh-agent
session start --temp ... Temporary session (nothing saved)
session stop Unload key / end temp session
session status Show agent status
security Audit all identities
export --all Export encrypted bundle
import <file> Import from bundle
doctor Full health check
tui Interactive menu
completion <shell> Shell completions
hook install|uninstall Pre-commit identity guard
--update Update to latest version
--version / -v Show versionAliases: ls → list · sw → switch · rm → remove
What Gets Modified
~/.git-users/config.json ← your identities (never auto-deleted)
~/.gitconfig ← updated on every switch
~/.ssh/git_<name> ← private key (stays on your machine)
~/.ssh/git_tmp_<name> ← temp session key (deleted on stop)Your repositories are never touched.
Full Documentation
→ github.com/divyo-argha/git-user
License
MIT
If git-user saved you from a wrong-account commit, consider giving it a ⭐
