Switch your Git Hats
GitHat is a lightweight CLI tool that lets you bind GitHub accounts per repository and run Git commands securely using HTTPS + encrypted tokens. Seamlessly manage multiple GitHub accounts on a single machine — without SSH, without credential conflicts, and without leaking tokens.
If you’ve ever:
- worked with personal + work GitHub accounts
- accidentally pushed a commit with the wrong identity
- fought with SSH keys, global Git config, or credential helpers
👉 GitHat fixes all of that.
- ✅ No SSH setup required
- ✅ No global Git config changes
- ✅ No credential helper pollution
- ✅ Repo-level account binding
- ✅ Encrypted token storage
- ✅ Works with standard
gitcommands
GitHat introduces account-aware Git execution.
You can either:
- explicitly choose an account
- or bind an account to a repo and forget about it
githat personal: git push
githat git push # auto-uses bound accountnpm install -g githatVerify:
githat --versionGitHat uses HTTPS + Personal Access Tokens (PAT).
githat add personal \
--user yourGithubUsername \
--email your@email.com \
--token YOUR_GITHUB_TOKEN🔒 Tokens are encrypted before being stored.
githat listOutput:
📂 GitHat Accounts:
personal → Your Name <your@email.com>
work → Company Name <work@email.com>
githat personal: git clone https://github.com/user/repo
githat work: git push✔ No SSH ✔ No prompts ✔ No credential caching
Bind an account once per repository.
cd my-project
githat bind personalThis creates:
.git/githat.json
{
"account": "personal"
}githat statusOutput:
📌 Repo bound to: personal
githat git add .
githat git commit -m "Initial commit"
githat git push🎯 GitHat automatically uses the bound account.
GitHat is designed to never leak credentials.
- Tokens are encrypted at rest
- Decrypted only in memory
- Never written to Git config
- Never exposed in logs
credential.helperdisabledGIT_ASKPASSused securelyGIT_TERMINAL_PROMPT=0- No global Git state touched
githat add <name>
githat list
githat remove <name>githat bind <name>
githat statusgithat personal: git push
githat git pull
githat git clone <url>- ❌ Does not modify
~/.gitconfig - ❌ Does not rely on SSH keys
- ❌ Does not override system Git
- ❌ Does not store tokens in plaintext
- ❌ Does not affect normal
gitusage
CLI Entry
├── Prefix Parser (personal:)
├── Repo Binding Resolver
├── Account Loader
└── Git Executor
├── Token Injection
├── Identity Override
└── Secure AskPass
# Setup once
githat add personal --user john --email john@mail.com --token XXX
githat add work --user john-work --email john@company.com --token YYY
# Per repo
cd work-repo
githat bind work
cd personal-repo
githat bind personal
# Forever after
githat git push # always correct account- Auto-bind on clone
githat unbind- Repo override warnings
- GitHub Enterprise support
- Token rotation helpers
PRs are welcome.
git clone https://github.com/yourname/githat
cd githat
npm install
npm linkMIT License © 2025
GitHat exists to make multi-account Git workflows boring again — no surprises, no mistakes, no stress.
If you work with multiple GitHub accounts, this tool is for you.