Skip to content
gity
Open source · MIT · 3 runtime deps

One machine.
Every GitHub account.
Zero mix-ups.

gity auto-selects the right Git name, email, and SSH key based on the folder your repo lives in — using Git's own includeIf. No manual switching, ever.

View on GitHub
Non-destructive — only appends to ~/.gitconfig macOS · Linux · Windows
zsh — gity
The problem

Multiple accounts. One machine. Constant identity leaks.

Work, personal, freelance — the moment several GitHub accounts share a computer, commits go out with the wrong email and pushes use the wrong key. gity makes the rule simple: a folder is an account.

Before

Fragile, manual, easy to forget

  • Wrong-email commits leak your work identity into personal repos (and vice-versa).
  • Permission denied (publickey) because the wrong SSH key is offered first.
  • Brittle ~/.ssh/config host aliases like git@github-work you must remember to use.
  • Running git config user.email … by hand in every single repo.
After

Decide once. It just works.

  • Decide once that a folder maps to an account — gity does the rest.
  • gity wires includeIf + a dedicated SSH key per profile.
  • Keep using normal git@github.com:owner/repo.git URLs — no host aliases.
  • The correct name, email, and key are selected automatically by location.
How it works

A folder is an account. Git's own includeIf does the switching.

gity makes two append-only changes to your Git config. There's no daemon, no database, no wrapper around git — just plain config files Git already understands.

~/Developmentworkpersonalfreelance
~/Development/work/* → you@company.com + id_ed25519_work
~/Development/personal/* → you@gmail.com + id_ed25519_personal
~/Development/freelance/* → you@freelance.dev + id_ed25519_freelance
~/.gitconfig
[includeIf "gitdir:~/Development/work/"]
  path = ~/.gitconfig-work
~/.gitconfig-work
[user]
  name = Jane Doe
  email = jane@company.com
[core]
  sshCommand = "ssh -i ~/.ssh/id_ed25519_work -o IdentitiesOnly=yes"

IdentitiesOnly=yes forces SSH to use only that key — no more "wrong key offered first."

Install

One command on every platform

Needs Node.js ≥ 18 and an OpenSSH client. We detect your OS automatically — switch tabs anytime.

$npm install -g gity-tool

Get Node via brew install node. OpenSSH is built in on macOS.

The npm package is gity-tool — the installed command is gity.

Quick start

From install to authenticated in three steps

1

Run gity add

Answer a few prompts — profile name, full name, email, projects folder, and optional SSH key generation.

2

Add the key to GitHub

Paste the printed public key into GitHub → Settings → SSH and GPG keys.

3

Run gity test

See ✓ authenticated for each profile. You're done — start cloning into that folder.

Commands

Three commands. That's the entire surface.

No flags to memorize, no config syntax to learn. gity is a thin, friendly wrapper over Git's native behavior.

gity add

Interactive wizard: profile name, full name, email, projects folder, and optional SSH key generation. Prints the public key to paste into GitHub.

$ gity add
◇ Profile name … work
◇ Email … jane@company.com
◇ Folder … ~/Development/work
◇ Generate SSH key? … Yes
✓ Done.
gity list / ls

A table of all profiles — their folders, emails, and SSH key status — so you can see your whole setup at a glance.

$ gity list
profileemailkey
workjane@company.com✓ key
personaljane@gmail.com✓ key
gity test / t

Verifies each profile authenticates with GitHub, so you know the right key reaches the right account before you push.

$ gity test
✓ work — authenticated as jane-at-work
✓ personal — authenticated as jane-personal
Use case

Work + personal on one laptop

1 Run gity add for work2 Run gity add for personal3 Add each public key to the matching account
# work identity — selected because of the folder
$ cd ~/Development/work && git clone git@github.com:company/api.git

# personal identity — same host, different folder
$ cd ~/Development/personal && git clone git@github.com:jane/blog.git

Same git@github.com URLs — gity picks the right key per folder.

Why gity

Small, sharp, and dependable by design

Folder-based auto-switching

Identity follows location. Drop a repo in a folder and the right name, email, and key apply automatically.

Per-profile SSH keys

Each account gets its own key, pinned with IdentitiesOnly=yes so the wrong key is never offered.

Non-destructive config

gity only appends to ~/.gitconfig — it never rewrites or removes your existing settings.

Cross-platform

macOS, Linux (Ubuntu/Debian/Fedora), and Windows (PowerShell, CMD, Git Bash). One tool everywhere.

KISS — 3 deps, no DB

Three runtime dependencies, no database, no daemon. State is plain Git config files you can read.

MIT open source

Free and MIT licensed. Read the code, file an issue, or send a PR — it's all on GitHub.

Stop leaking identities. Start with one command.

Set a folder, run the wizard, push with confidence. gity handles the rest.

View on npmGitHub
Copied!