A lightweight git wrapper that censors Personally Identifiable Information (PII) from git output before it reaches AI coding assistants.
AI tools like Claude Code and Cursor routinely read git history for context — commit logs, diffs, and more. Commands like git log and git show expose author names and email addresses in their output, leaking PII to the model. This can feel intrusive, and creates friction for teams with strict data handling policies.
anony-git strips author information from git commands known to leak it.
anony-git intercepts git commands and applies command-specific redaction before proxying to git. All other commands pass through unchanged.
git log,git show— injects--oneline, limiting output to the commit hash and subject line with no author or email.git blame— strips flags that would expose author data (-p,--porcelain,--line-porcelain,-e,--incremental) and injects-sand--no-show-emailto suppress the author name and email fields.git shortlog— strips any user-supplied--groupor--formatflags and injects--group=format:%as, grouping output by date instead of by author or email.
| Command | Status |
|---|---|
git log |
Redacted |
git show |
Redacted |
git blame |
Redacted |
git shortlog |
Redacted |
All other commands pass through to git without modification.
git clone git@github.com:drewstaylor/anony-git.git
cd anony-git
cargo build --releaseThe binary will be located at ./target/release/anony-git.
Shell aliases are not inherited by Claude Code's subprocesses, so a symlink on PATH is required instead.
Step 1 — Create a git symlink pointing to the anony-git binary:
macOS / Linux:
mkdir -p ~/.claude/bin
ln -s /absolute/path/to/anony-git/target/release/anony-git ~/.claude/bin/gitWindows (PowerShell, run as Administrator):
New-Item -ItemType Directory -Force "$env:USERPROFILE\.claude\bin"
New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\.claude\bin\git.exe" -Target "C:\absolute\path\to\anony-git\target\release\anony-git.exe"Step 2 — Add the symlink directory to the front of PATH in Claude Code's settings.
Critical: Claude Code does not support
$PATHexpansion in theenvblock — you must hardcode the full path string. Do not just paste a minimal example like/usr/bin:/bin. If you omit directories that your system tools live in (Homebrew, nvm, Cargo, pyenv, etc.), Claude Code will lose access to those tools entirely, breaking commands that rely on them.
The safe approach is to prepend ~/.claude/bin to your existing PATH. First, print your current PATH in a terminal:
echo $PATHThen, in your settings.json, paste that output as the value — with ~/.claude/bin: (macOS/Linux) or %USERPROFILE%\.claude\bin; (Windows) added to the front:
macOS / Linux (~/.claude/settings.json):
{
"env": {
"PATH": "/Users/YOUR_USERNAME/.claude/bin:<paste your echo $PATH output here>"
}
}For example, a realistic entry might look like:
{
"env": {
"PATH": "/Users/alice/.claude/bin:/opt/homebrew/bin:/Users/alice/.nvm/versions/node/v24.7.0/bin:/usr/local/bin:/usr/bin:/bin:/Users/alice/.cargo/bin"
}
}Windows (%USERPROFILE%\.claude\settings.json):
{
"env": {
"PATH": "C:\\Users\\YOUR_USERNAME\\.claude\\bin;<paste your $env:PATH output here>"
}
}Note: To scope the configuration to a single project rather than all Claude Code sessions, add the same
envblock to.claude/settings.jsonin the project root instead of the global settings file.
How it works without infinite recursion: When anony-git (symlinked as git) is invoked, it detects its own location on PATH and skips it when searching for the real git binary — so placing ~/.claude/bin first is safe and won't cause anony-git to call itself.
If you're unable to extend the PATH used by Claude Code's subprocesses using the settings.json approach above, you can create shell aliases to toggle ~/.claude/bin on and off for individual terminal sessions.
Add the following to your ~/.bash_profile (or ~/.zshrc for Zsh):
alias anonygit-on='export PATH="$HOME/.claude/bin:$PATH"'
alias anonygit-off='export PATH="<your original PATH without ~/.claude/bin>"'To create the anonygit-off alias, first print your current PATH (before enabling anony-git):
echo $PATHThen paste that output as the value in anonygit-off. For example:
alias anonygit-on='export PATH="$HOME/.claude/bin:$PATH"'
alias anonygit-off='export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/.cargo/bin"'After sourcing your profile (source ~/.bash_profile or source ~/.zshrc), you can run anonygit-on before starting Claude Code to enable redaction, and anonygit-off to restore your original PATH.
Add the following to your Cursor settings.json:
{
"git.path": "/absolute/path/to/anony-git/target/release/anony-git"
}Replace the path with the absolute path to the binary on your system.
Settings file locations:
- macOS:
~/Library/Application Support/Cursor/User/settings.json - Linux:
~/.config/Cursor/User/settings.json - Windows:
%APPDATA%\Cursor\User\settings.json
For a project-specific override, add git.path to .vscode/settings.json in the project root instead.
Note: Shell aliases (e.g.
alias git=...) do not work for Cursor's built-in git features. Thegit.pathsetting is required. This also affects Cursor's SCM panel, not just the integrated terminal — which means author information will be redacted from Cursor's source control UI as well.
Unlike the Claude Code setup, Cursor's git.path points directly to the anony-git binary — there is no git symlink involved, so there is no risk of infinite recursion. anony-git finds the real git by searching the PATH that Cursor inherits from your shell environment, which already contains the system git.
Restart Cursor after saving the setting.