_______ __ __ ___
/ ____(_) /_/ |/ /_ ___ __
/ / __/ / __/ /|_/ / / / / |/_/
/ /_/ / / /_/ / / / /_/ /> <
\____/_/\__/_/ /_/\__,_/_/|_|
Multi-Profile Identity & Security Manager for Git
- ❔ What is Gitmux
- ✨ Features
- 🚀 Quick Start
- 📖 How it Works
- ⚙️ Under the Hood (Architecture)
- 🧹 Cleanup & Uninstall
- 📄 License
- 🤝 Contributing
- 📬 Contact
Managing multiple Git identities (like Work and Personal) on the same machine usually means dealing with manual SSH tweaks, generating GPG keys, and remembering to set user.email for every repository you clone.
GitMux is a standalone bash script that automates this entire setup process.
It acts as a one-time configuration wizard. You define your profiles and assign them to specific base directories (e.g., ~/Work and ~/Personal). GitMux then uses Git's native includeIf directive to route your identities based on the folder you are in. Any repository cloned inside ~/Work will automatically use your work email, SSH key, and GPG signature.
Note
GitMux is not an application you install. It has no background daemons or runtime dependencies. It simply generates native Git and OpenSSH configurations, creates the necessary keys, and exits. Once the script finishes, your system continues to use vanilla Git.
- 👻 Zero Bloat: Works purely as a one-time setup wizard. No background processes, no installations. It just configures your native Git/SSH and exits.
- 📂 Directory-Based Routing: Automatically switches your Git user and email based on the directory you are working in using Git's native
includeIfdirective. No more--localconfigs. - 🔑 Automated SSH Management: Generates ED25519 SSH keys securely. Choose between transparent routing (
core.sshCommand) or classic SSH aliases. - 🛡️ GPG Commit Signing: Automatically detects or generates RSA-4096 GPG keys in unattended batch mode. Configures
commit.gpgsignto give your commits that shiny "Verified" badge. - 🔁 Idempotent & Safe: Run it as many times as you want. System modifications are isolated within marker blocks, ensuring your custom global settings are never touched.
- 🖥️ Interactive UI & Export: Outputs a neatly formatted, step-by-step terminal dashboard and automatically saves a backup log (
gitmux_summary.log) to help you easily copy your public keys to GitHub/GitLab
You can download and run GitMux using a single curl command. No Node.js, Python, or external dependencies required.
curl -O https://raw.githubusercontent.com/wd006/gitmux/main/gitmux.sh && chmod +x gitmux.sh && ./gitmux.sh- Bash (macOS or Linux)
gpg(Optional, but required if you want the Verified badge on your commits. Install viabrew install gnupgorapt install gnupg).
Once executed, the CLI wizard will guide you through the setup. For each profile you want to configure, you will be asked:
- Profile Info: Name (e.g.,
work), Git username, and email. - Base Directory: The root folder for this profile (e.g.,
~/Projects/Work). - SSH Routing Method:
- Transparent (Recommended): Injects
core.sshCommandinto your Git config. You can keep using standard clone URLs (git clone git@github.com:repo.git). - Classic (Alias): Modifies your
~/.ssh/config. Requires using alias clone URLs (git clone git@github-work:repo.git).
- Transparent (Recommended): Injects
- GPG Setup: Choose whether to auto-generate a GPG key for the "Verified" badge.
- Dashboard: Follow the on-screen instructions to copy the generated keys to GitHub/GitLab.
GitMux is built with system safety in mind. Here is exactly what it does to your system:
- Isolated Sub-configs: Creates hidden configuration files for each profile (e.g.,
~/.gitconfig-work). - Global Config Injection: Modifies your global
~/.gitconfigand~/.ssh/configfiles by wrapping its rules inside# === BEGIN GITMUX AUTO-GENERATED ===blocks. - Cross-Platform: Uses standard POSIX
awkto ensure text replacements work flawlessly across both GNU (Linux) and BSD (macOS) environments.
Made a mistake or want to revert your machine to its original state? You can safely strip all GitMux configurations from your global files.
./gitmux.sh --clean(Note: This only removes the routing blocks from ~/.gitconfig and ~/.ssh/config. Your generated SSH/GPG keys and project folders will remain untouched).
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions are greatly appreciated. Please fork the repository and create a pull request, or open an issue for major changes.
E-Mail: github@wd006.pp.ua
Project Link: https://github.com/wd006/gitmux
For questions, bug reports, or support, please open an issue on the GitHub repository.