Multiple Git Identities

Easily manage multiple Git identities (user.name & user.email) across different repositories!

Do you work with multiple Git accounts (e.g., personal, work, freelance) and struggle with switching identities? This script helps you maintain different Git configurations per repository without manual changes.


🔧 How It Works

  1. Automatically detects the repository’s remote URL (GitHub, GitLab, etc.).
  2. Matches the URL against predefined identity rules in ~/.gitconfig.
  3. Sets the correct user.name and user.email for that repository.

No more accidental commits with the wrong email!

🚀 Configuration

Define your identities in ~/.gitconfig (example in git repo).

And follow this repo for steps:

git clone https://github.com/navinku/MultipleGitIdentities.git
cd MultipleGitIdentities

✅ Usage

Once installed, every git commit in any repository will automatically use the correct identity.

🤝 Contributing

PRs welcome! Found a bug or have an improvement? Open an issue or submit a pull request.


Why This?

  • No manual git config: Set-and-forget identities.
  • Lightweight: Pure Git hooks, no extra dependencies.
  • Cross-platform: Works on macOS/Linux (Windows support via Git Bash/WSL).

📌 Star this repo if it saves you time!

GitHub - navinku/MultipleGitIdentities
Contribute to navinku/MultipleGitIdentities development by creating an account on GitHub.