Wrong hat? Switch before you push.

Hats is a menu bar app for developers with more than one GitHub account. Bind a folder to a profile and every repo inside wears the right identity: commit email, SSH key, gh session, signing. Forget anyway, and the guard blocks the push.

Free · macOS 14+ · brew install --cask hats

Your identity is four layers.
The usual fixes patch one.

includeIf sets the email. SSH aliases pick the key. gh auth switch changes the CLI. Each fixes its own layer and leaves the other three ready to betray you. Hats moves all four as one.

user.email Commit identity
Your personal email, written into the client's history forever.
core.sshCommand Push authentication
Permission denied. Or worse: the push goes through as the wrong account.
gh auth GitHub CLI
The pull request opens from the account your client has never heard of.
commit.gpgsign Commit signing
A gray “Unverified” badge on every commit you make.

Your folders decide
who you are.

Bind a folder to a profile once. Every repository inside it, today's and next year's, wears that hat: right email, right key, right gh account, right signature. Clone anywhere under it and you're already the right person.

Prefer to think in organizations? Bind a GitHub org instead, and any of its repos wears the hat wherever you clone it. Underneath it's plain git includeIf: readable, removable, yours.

$ hats rule add --folder ~/clients/acme acme

9:02

Your side project

Coffee, personal hat on. Commits signed with your own name, pushed with your own key. Green light, nothing to think about.

9:41

Standup's over, into the work monorepo

One cd and the folder rule flips all four layers at once: commit email, SSH key, gh session, signing. You typed nothing, you forgot nothing.

14:10

Acme needs a hotfix

Different client, different identity, same zero effort. The right hat is already on when the terminal lands in the folder.

18:45

A quick test clone in /tmp

Outside every rule, old reflexes take over, and the commit would leave as personal. The guard refuses it, and prints the way out.

18:46

One command, and home

hats use acme: four layers flip, verdict turns green. Push, close the laptop.

cd ~/dev/side-projectcd ~/work/platformcd ~/clients/acme/billinggit clone acme-inc/billing /tmp/hotfixhats use acme
personal korp acme
Switched to korp: email, key, gh, signing Switched to acme: email, key, gh, signing
side-project ~/dev platform ~/work billing ~/clients/acme hotfix /tmp
you/side-project korp-eng/platform acme-inc/billing
✓ Identity matches this folder
⚠ Outside your rules: wrong hat
hotfix — zsh
$ git commit -m "Hotfix rounding"hats: wrong hat. This repo belongs to 'acme'.✗ commit blocked$ hats use acmeNow wearing 'acme'. gh CLI switched too.
billing — zsh — 80×24
billing % hats statusActive profile: acme <dev@acme.com>Repo: ~/clients/acme/billing (main)Verdict: ✓ identity matches profile 'acme'billing % hats rule add --folder ~/clients/acme acmeRule added: folder '~/clients/acme/' → acmebilling % hats doctor✓ git 2.44   ✓ gh authenticated   ✓ guard hooks installedbilling % ▍

The terminal gets
the same brain

Everything the menu bar does, the hats CLI does too: switch, add rules, check the verdict, run the doctor. Same engine, same guarantees, so your scripts and CI rituals stay honest.

And when something on the machine fights you, an old URL rewrite, a repo overriding hooks, a key that never reached GitHub, hats doctor names it and prints the fix.

Built like a good tool

Ready in a minute

  1. 1
    Install

    Download the app or use Homebrew. It lives in your menu bar from the first launch.

    brew install --cask hats
  2. 2
    Add your hats

    One profile per account: the onboarding imports your existing identity, connects GitHub in your browser, and handles the SSH keys for you.

  3. 3
    Bind your folders

    Point each folder, or a whole GitHub org, at its profile. From then on the right hat is on before you even open the editor.

    ~/clients/acme → acme

Pricing

Free

$0

forever

  • 2 profiles
  • One-click switching, shortcuts, CLI
  • Folder & branch context
  • Identity verdict on every repo
Download

Pro

$12.99

one-time license, yours forever

  • Unlimited profiles
  • Automatic rules per folder & GitHub owner
  • The guard: blocks wrong-hat commits and pushes
  • Per-folder gh token
Get Hats Pro

Losing the license never touches your setup: extra profiles and rules are kept, and come back the moment it's active again.

Questions

Does it break husky, commitlint, or my existing hooks?

No. The guard's hooks run your repo's own hooks right after their check, so husky and friends keep working exactly as before. If a repo sets its own hooksPath, Hats detects it and tells you the guard is inactive there, instead of failing silently.

Where do my keys and tokens live?

Where they already do. GitHub tokens stay in gh's keychain storage, private keys stay in ~/.ssh, passphrases go to the macOS Keychain through ssh-agent. Hats stores configuration, never secrets.

What does it actually change on my machine?

One clearly-marked include block at the end of ~/.gitconfig, pointing at files Hats manages in ~/.config/hats. Your file is backed up before any change, every generated file is validated with git itself, and hats uninstall puts everything back.

Do I need the shell integration?

Only for the live folder context. It's one line in your shell config, installed and removed from the app with a backup, and it runs in the background without slowing your prompt. Everything else works without it.

Can I bypass the guard for one commit?

Yes: HATS_SKIP=1 git push. The guard is there to catch mistakes, not to argue with you.

GitLab? Bitbucket? GitHub Enterprise?

Version 1 is GitHub-focused. Profiles already carry a host field, so other hosts are on the table for later. The model was built for it.