GitIdentitree
A CLI tool written in Go to manage multiple Git identities and switch profiles automatically based on directory context.
CLI COMPLETED
Overview
GitIdentitree is a lightweight command-line tool written in Go that manages multiple Git identities on a single machine. If you switch between work projects, personal side-projects, and open-source contributions, GitIdentitree automatically resolves and activates the right profile (name, email, GPG key, and SSH key) based on your current directory.
Features
Multiple Git profiles
- Configure distinct profiles for work, personal, or client projects.
- Set author names, emails, and GPG signing keys per profile.
Directory-based switching
- Automatically activates profiles when you navigate to a project folder.
- Uses Git’s native
includeIfdirective without modifying external global configs. - No background daemons or CPU overhead.
SSH key management
- Automatically loads and unloads the matching SSH key when switching directories.
- Shell completion support for Bash, Zsh, Fish, and PowerShell.
Terminal UI (TUI)
- Interactive terminal interface built with Bubble Tea and Huh.
- Quick overview of active folder-to-profile mappings.
Safe operations
- Prevents accidental deletion of profiles currently mapped to folders.
- Automatic home directory (
~) path expansion.
Installation
Pre-built binaries are available for macOS, Linux, and Windows:
# macOS (Apple Silicon)
curl -L https://github.com/thuanlegit/git-identitree/releases/latest/download/gidtree-darwin-arm64 -o gidtree
chmod +x gidtree
sudo mv gidtree /usr/local/bin/
Quick start
# Initialize
gidtree init
# Create a profile
gidtree profile create
# Map profile to a directory
gidtree map work ~/projects/work
# Verify
cd ~/projects/work
git config user.email