Manage multiple Git identities. Never commit with the wrong email again.
$ git profile use Personal
✓ Switched to profile "Personal"
Scope: Local
Repository: my-side-project
Name: Malay Kumar
Email: malay@gmail.com
git-profile is a Git extension that lets you define named profiles (work, personal, open-source) and switch between them per repository. It integrates with Git's native extension system — just type git profile.
Part of the gitx ecosystem.
If you use Git with multiple accounts, you've probably:
- Committed to a work repo with your personal email
- Had to
git config user.email ...in every new clone - Forgotten which identity a repository is using
- Wished Git had a built-in "profile" concept
git-profile fixes all of this.
# Install
go install github.com/Malay-dev/gitx-profile@latest
# Create profiles
git profile add personal --name "Alice" --email "alice@gmail.com"
git profile add work --name "Alice" --email "alice@acmecorp.com"
# Or inherit from your existing global config
git profile add work --from global
# Switch identity (current repo only)
git profile use work
# See what's active
git profile current
# Inspect a repo's full identity setup
git profile showgo install github.com/Malay-dev/gitx-profile@latestThe binary is named git-profile. Git automatically discovers it as git profile.
Download the binary for your platform from Releases, extract it, and place it somewhere in your PATH:
# macOS / Linux
sudo mv git-profile /usr/local/bin/
# Or without sudo
mkdir -p ~/.local/bin
mv git-profile ~/.local/bin/git profile --helpIf Git finds it, you're good.
Create a new profile.
# Interactive
git profile add work
# With flags
git profile add work --name "Alice" --email "alice@acmecorp.com"
# Inherit from global git config (with confirmation prompt)
git profile add work --from global
# Clone from an existing profile (override what's different)
git profile add oss --from work --email "alice@opensource.org"Switch to a profile. Writes to the current repo by default (not global).
git profile use work
# ✓ Switched to profile "work"
#
# Scope: Local
# Repository: inventory-service
# Name: Alice
# Email: alice@acmecorp.comUse --global to change the global default:
git profile use personal --globalShow the active identity and which profile it matches.
git profile current
# ✓ Profile: work
#
# Name: Alice
# Email: alice@acmecorp.com
# Repository: inventory-service
# Scope: Local (.git/config)List all saved profiles. Active one is marked with *.
git profile list
# * work <alice@acmecorp.com>
# personal <alice@gmail.com>
# oss <alice@opensource.org>Discover the full identity configuration of the current repository.
git profile show
# === Repository ===
#
# Name: inventory-service
# Remote (origin): git@github.com:AcmeCorp/inventory-service.git
# Branch: main
#
# === Identity ===
#
# user.name: Alice
# user.email: alice@acmecorp.com
#
# Source breakdown:
# user.name: Alice (local — .git/config)
# user.email: alice@acmecorp.com (local — .git/config)
#
# === Profile ===
#
# ✓ Matched: workVerify the current identity matches a known profile. Useful in pre-commit hooks.
git profile check
# ✓ Identity matches profile "work"
git profile check --quiet
# (exit code 0 = match, 1 = mismatch)Run diagnostics on your Git identity setup.
git profile doctorDelete a saved profile. Does not change any existing git config.
git profile remove old-workManage identity policies — control which profiles are allowed in which repos.
git profile policy create
# Policy name: acme-corp
# Remote patterns: github.com/AcmeCorp/*
# Allowed profiles: work
# Mode (strict/warning/advisory): strict
#
# ✓ Policy "acme-corp" createdProfiles are stored in ~/.gitprofiles:
[profile "personal"]
name = Alice
email = alice@gmail.com
[profile "work"]
name = Alice
email = alice@acmecorp.com
signingkey = ABC123When you run git profile use work, the tool executes:
git config user.name "Alice"
git config user.email "alice@acmecorp.com"That's it. No magic. Git remains the source of truth.
git profile use work → .git/config (this repo only)
git profile use work --global → ~/.gitconfig (all repos without local override)
Policies prevent using the wrong profile in a repo. Two levels:
User-level (~/.git-profile/policies.yaml):
policies:
- name: acme-corp
remotePatterns:
- "github.com/AcmeCorp/*"
allowedProfiles:
- work
mode: strictRepo-level (.gitprofile.yml in repo root):
organization: AcmeCorp
allowedProfiles:
- work
mode: strictModes: strict (blocks), warning (asks), advisory (suggests).
| Variable | Description | Default |
|---|---|---|
GITX_PROFILES_PATH |
Custom path to profiles file | ~/.gitprofiles |
GITX_POLICIES_PATH |
Custom path to policies file | ~/.git-profile/policies.yaml |
- Core CLI (add, list, use, current, show, check, remove, doctor)
-
--fromflag (inherit from global config or existing profile) - Policy engine (user-level + repo-level)
- CI/CD (GitHub Actions + GoReleaser)
- Remote-based auto-suggestions
- Pre-commit hook integration (
git profile enable-guard) - SSH key switching (v2)
- gitx plugin marketplace (separate project)
git-profile is the first tool in a broader vision: gitx — a platform for Git extensions.
Future plugins:
git-guard— enforce branch and commit policiesgit-doctor— comprehensive Git health diagnosticsgit-secrets— prevent secrets from being committed
Each plugin is standalone, installable via gitx install, and follows Git's native extension pattern.
See idea.md for the full vision.
See CONTRIBUTING.md for setup instructions, project structure, and guidelines.
