Session-based Git profile manager — right identity, every commit
Project description
Grit
Session-based Git profile manager — right identity, every commit.
What is Grit?
Grit is a cross-platform background daemon that manages multiple Git identities — name, email, GPG signing key, SSH key — across all your repositories. It uses session-based memory to automatically apply the right profile per repository, prompting you just-in-time when a new repository is first encountered.
No more wrong-account commits. No global git config juggling. Grit handles it silently in the background.
Features
- Session memory — remembers your active profile per repository for a configurable TTL (default 8 hours)
- Auto-detection —
.gritfile in the repo root, path glob patterns (~/work/*), or remote URL patterns select the right profile automatically - Git hook integration — installs a
pre-commithook that applies the correct identity before every commit - System tray — live profile indicator with one-click profile switching
- VS Code extension — active profile in the status bar, switch profiles from the command palette
- GPG signing — per-profile commit signing key, configured automatically
- SSH keys — per-profile
core.sshCommandconfigured viassh -i <key> - HTTP credentials — per-profile GitHub username routing for HTTPS remotes
- Up to 5 profiles — free tier, no account required, fully offline
Installation
pip install grit
Requirements: Python 3.8+, Git 2.x
Optional extras:
pip install "grit[ui-qt]" # PyQt6 profile picker dialog
pip install "grit[linux-keyring]" # keyring integration on Linux
pip install "grit[windows]" # pywin32 for Windows Credential Manager
Quick Start
# First-time setup (creates config, first profile, installs autostart)
grit setup
# Add more profiles
grit profile add
# Activate a profile in the current repository
grit session set Work
# See which profile is active here
grit session show
# List all profiles (active one is highlighted)
grit profile list
How It Works
git commit
└─▶ .git/hooks/pre-commit
└─▶ grit hook pre-commit --repo <path>
└─▶ IPC → daemon
└─▶ SessionEngine.resolve()
├─ session cache hit → apply profile → done
├─ auto-detect (.grit / path pattern / remote) → create session → apply
└─ no match → prompt user via popup / tray
Profile data is written directly to the repository's local git config — no wrapper scripts, no shims.
Auto-detection priority
.gritfile in the repo root (profile = Work)- Path pattern match (
~/work/*→ Work profile) - Remote URL pattern match (
github.com/my-company/*→ Work profile) - Prompt — one-time selection, then remembered for the session TTL
Commands
Profiles
grit profile add # create a profile (interactive wizard)
grit profile add -n Work -e work@company.com --gpg-key ABC123
grit profile list # list all profiles; active one marked
grit profile show <name> # show full details
grit profile edit <name> --email new@email.com
grit profile delete <name>
Sessions
grit session show # active profile in this repo
grit session set <profile> # activate a profile in this repo
grit session list # all active sessions
grit session clear # end the session for this repo
Daemon
grit daemon start # start background daemon
grit daemon start --foreground # run in foreground (development)
grit daemon stop
grit daemon status
grit daemon restart
Setup & Info
grit setup # first-run wizard
grit about # version, plan, contact
grit upgrade # feature comparison: Free / Pro / Enterprise
Configuration
Config is stored in the platform-specific user directory:
| Platform | Path |
|---|---|
| macOS | ~/Library/Application Support/grit/ |
| Linux | ~/.config/grit/ |
| Windows | %APPDATA%\grit\ |
Override with the GRIT_CONFIG_DIR environment variable (useful for testing).
Key settings (grit config set <key> <value>):
| Key | Default | Description |
|---|---|---|
session_ttl_hours |
8 |
How long a session stays active |
auto_detect |
true |
Enable profile auto-detection |
cloud_sync_enabled |
false |
Enable cloud sync (Pro) |
Data Files
| File | Contents |
|---|---|
profiles.json |
Your Git identity profiles |
sessions.json |
Active sessions per repository |
config.json |
App configuration |
grit.pid |
Daemon PID |
grit.sock |
IPC socket (macOS / Linux) |
All writes are atomic (.tmp → os.replace()).
Platform Support
| Feature | macOS | Linux | Windows |
|---|---|---|---|
| Core daemon + CLI | ✓ | ✓ | ✓ |
| System tray | ✓ | ✓ (X11) | ✓ |
| Autostart | LaunchAgent | XDG / systemd user | Registry Run key |
| IPC | Unix socket | Unix socket | TCP loopback |
| GPG signing | ✓ | ✓ | ✓ |
| SSH key routing | ✓ | ✓ | ✓ |
| Windows Credential Manager | — | — | ✓ |
Development
git clone <repo>
cd grit
pip install -e ".[dev]"
# Run tests
pytest tests/unit/ # fast unit tests
pytest tests/unit/ --cov=grit # with coverage
pytest -m integration # requires real git binary
pytest -m e2e --timeout=60 # full end-to-end (CI only)
# Code quality
ruff check src/ tests/
ruff format src/ tests/
mypy src/
Grit Pro — Coming Soon
Grit Pro adds:
- Unlimited profiles (free tier: 5)
- Cloud sync — profiles and sessions across all your machines
- Team profiles — org-wide read-only profiles pushed from your admin dashboard
- Enterprise SSO — OIDC and SAML 2.0 login
- Audit logs — SIEM-ready append-only log of every profile switch
- Compliance reporting — hook inventory, GPG enforcement, SSO compliance
Grit Pro is not yet available. Pre-register to be notified at launch:
kandeepasundaram+GRIT@gmail.com
License
MIT — see LICENSE.
Made with grit.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grit_cli-0.1.0a0.tar.gz.
File metadata
- Download URL: grit_cli-0.1.0a0.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6dddb9fe0e6afea6351c109c499bf7a431c3c361bb813de26d2a3822a0c3944
|
|
| MD5 |
69b6102d63b52b0b31ef033f6e3d0562
|
|
| BLAKE2b-256 |
db5a1545b6730be66a30b71259a474e894632aa114c4fb2aed032cc231237d3e
|
Provenance
The following attestation bundles were made for grit_cli-0.1.0a0.tar.gz:
Publisher:
release.yml on Kandeepasundaram/Grit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grit_cli-0.1.0a0.tar.gz -
Subject digest:
c6dddb9fe0e6afea6351c109c499bf7a431c3c361bb813de26d2a3822a0c3944 - Sigstore transparency entry: 1922178509
- Sigstore integration time:
-
Permalink:
Kandeepasundaram/Grit@526b6552d57428d2d799a9175362a99d96dc871f -
Branch / Tag:
refs/tags/v0.1.0a0 - Owner: https://github.com/Kandeepasundaram
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@526b6552d57428d2d799a9175362a99d96dc871f -
Trigger Event:
push
-
Statement type:
File details
Details for the file grit_cli-0.1.0a0-py3-none-any.whl.
File metadata
- Download URL: grit_cli-0.1.0a0-py3-none-any.whl
- Upload date:
- Size: 73.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
135bcd0bce34284b2634b2fc7f6f444eb5438266b5153809822b88d6404047da
|
|
| MD5 |
6181b9b89ea09099dc6013013db6b381
|
|
| BLAKE2b-256 |
adf4ee774a3d093f385ee27e1893406d09603f59a80c8f501948dad1e9ab6823
|
Provenance
The following attestation bundles were made for grit_cli-0.1.0a0-py3-none-any.whl:
Publisher:
release.yml on Kandeepasundaram/Grit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grit_cli-0.1.0a0-py3-none-any.whl -
Subject digest:
135bcd0bce34284b2634b2fc7f6f444eb5438266b5153809822b88d6404047da - Sigstore transparency entry: 1922178728
- Sigstore integration time:
-
Permalink:
Kandeepasundaram/Grit@526b6552d57428d2d799a9175362a99d96dc871f -
Branch / Tag:
refs/tags/v0.1.0a0 - Owner: https://github.com/Kandeepasundaram
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@526b6552d57428d2d799a9175362a99d96dc871f -
Trigger Event:
push
-
Statement type: