| Crates.io | ggid |
| lib.rs | ggid |
| version | 0.1.1 |
| created_at | 2025-11-28 04:10:15.875798+00 |
| updated_at | 2025-11-30 12:08:36.38539+00 |
| description | Git Identity Manager - A complete solution for managing multiple Git identities |
| homepage | |
| repository | https://github.com/ygwa/gid |
| max_upload_size | |
| id | 1954799 |
| size | 211,872 |
🔄 A complete solution for managing multiple Git identities
Features • Installation • Quick Start • Usage • Configuration
# Clone repository
git clone https://github.com/ygwa/gid.git
cd gid
# Install
cargo install --path .
# Or build release
cargo build --release
sudo cp target/release/gid /usr/local/bin/
brew install ygwa/tap/gid
Download binaries for your platform from the Releases page.
# Interactive add
gid add
# Or specify arguments
gid add --id work --name "John Doe" --email "john@company.com"
# Switch identity for current project
gid switch work
# Switch global identity
gid switch -g personal
# Add path rule
gid rule add -t path -p "~/work/**" -i work
# Add remote URL rule
gid rule add -t remote -p "github.com/my-company/*" -i work
# Apply rules automatically
gid auto
# Install to current repository
gid hook install
# Or install globally
gid hook install -g
gid - Git Identity Manager
Usage: gid <COMMAND>
Commands:
switch Switch to specified identity
list List all identities
current Show current identity
add Add a new identity
remove Remove an identity
edit Edit configuration file
export Export configuration
import Import configuration
rule Manage rules
doctor Check identity configuration issues
auto Automatically switch identity based on rules
hook Manage Git hooks
audit Audit commit history
completions Generate shell completion scripts
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
# List all identities
gid list
# Show current identity
gid current
# Add identity (interactive)
gid add
# Add identity (with SSH and GPG)
gid add --id work \
--name "John Doe" \
--email "john@company.com" \
--ssh-key ~/.ssh/id_work \
--gpg-key ABCD1234
# Remove identity
gid remove work
# Add path rule
gid rule add -t path -p "~/work/**" -i work
# Add remote URL rule
gid rule add -t remote -p "github.com/company/*" -i work
# List all rules
gid rule list
# Test rule matching
gid rule test
# Remove rule
gid rule remove 0
# Check identity configuration in current directory
gid doctor
# Auto fix
gid doctor --fix
# Auto switch based on rules
gid auto
# Install pre-commit hook (current repo)
gid hook install
# Install global hook
gid hook install -g
# Check hook status
gid hook status
# Uninstall hook
gid hook uninstall
# Audit current repository
gid audit
# Audit specified directory
gid audit --path ~/projects
~/.config/gid/config.toml%APPDATA%\gid\config\config.tomlCan be customized via GID_CONFIG_DIR environment variable.
# Identity List
[[identities]]
id = "work"
name = "John Doe"
email = "john@company.com"
description = "Work Identity"
ssh_key = "~/.ssh/id_work"
gpg_key = "ABCD1234"
gpg_sign = true
[[identities]]
id = "personal"
name = "John Doe"
email = "john@gmail.com"
description = "Personal Identity"
# Rule List
[[rules]]
type = "path"
pattern = "~/work/**"
identity = "work"
priority = 100
[[rules]]
type = "remote"
pattern = "github.com/my-company/*"
identity = "work"
priority = 50
# Settings
[settings]
verbose = true
color = true
auto_switch = false
pre_commit_check = true
strict_mode = false
Create a .gid file in the project root to specify the default identity:
work
# Bash
gid completions bash > /etc/bash_completion.d/gid
# Zsh
gid completions zsh > /usr/local/share/zsh/site-functions/_gid
# Fish
gid completions fish > ~/.config/fish/completions/gid.fish
# PowerShell
gid completions powershell > gid.ps1
# Debug mode
cargo build
# Release mode
cargo build --release
# Run tests
cargo test
src/
├── main.rs # Entry point
├── cli.rs # CLI definition
├── commands/ # Command implementations
├── config/ # Configuration management
├── rules/ # Rule engine
├── git/ # Git operations
├── ssh/ # SSH management
├── gpg/ # GPG management
└── audit/ # Audit functionality
Contributions are welcome! Please see CONTRIBUTING.md for details.
MIT License - see LICENSE file.
If this tool helps you, please give it a ⭐️