{"_id":"@anhducmata/git-manager","_rev":"5-9a361e5392a6cad904b21247968c77aa","name":"@anhducmata/git-manager","dist-tags":{"latest":"1.1.2"},"versions":{"1.0.0":{"name":"@anhducmata/git-manager","version":"1.0.0","keywords":[],"author":"","license":"ISC","_id":"@anhducmata/git-manager@1.0.0","maintainers":[{"name":"anhducmata","email":"anhducmata@gmail.com"}],"bin":{"gm":"index.js"},"dist":{"shasum":"9e6aa79a918056e4e7946e7ce1dd22961fb07954","tarball":"https://registry.npmjs.org/@anhducmata/git-manager/-/git-manager-1.0.0.tgz","fileCount":2,"integrity":"sha512-WXkCM8nTjVcQrxhLszSOO+K5Roi46F5lmi4AwsJExjUt67gPE/FDc+f/h8rrZHwTZQtIhXXXokZskql4jogF9A==","signatures":[{"sig":"MEYCIQCERTKIDWRQo4SR/uUZIkQn0UDvLLZ+cfkzzFQD7webHQIhALAAErOvTSruSqs08JEyk6fJA+9qCjFwmgAiLP7DYAfq","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7540},"main":"index.js","type":"module","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"anhducmata","email":"anhducmata@gmail.com"},"_npmVersion":"10.9.2","description":"CLI to easily manage and switch between multiple Git accounts","directories":{},"_nodeVersion":"23.10.0","dependencies":{"chalk":"^5.6.2","commander":"^14.0.3","@inquirer/prompts":"^8.3.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/git-manager_1.0.0_1775183647642_0.7751792133605937","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@anhducmata/git-manager","version":"1.0.1","keywords":[],"author":"","license":"ISC","_id":"@anhducmata/git-manager@1.0.1","maintainers":[{"name":"anhducmata","email":"anhducmata@gmail.com"}],"bin":{"gitm":"index.js"},"dist":{"shasum":"a58f3ccb5a76d35d02820892efb0ad9bf9580d38","tarball":"https://registry.npmjs.org/@anhducmata/git-manager/-/git-manager-1.0.1.tgz","fileCount":3,"integrity":"sha512-sYZSqQBiNGD6Oz59lK/7b3XVm5wRBr3rfeSx2ZXKmHqtVwG74VxjaEQCLBytxJMWecb0k4qGCwi5ZBm6yDbEOA==","signatures":[{"sig":"MEQCIAJzxisroasTac+l0XpFgdLJU9CV9ugvazzLFoiH1JEHAiBzrnZuJ0JpQdUtNSkXwzcfwNHsZSjSbdfW1ScyAvW+Hg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11617},"main":"index.js","type":"module","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"anhducmata","email":"anhducmata@gmail.com"},"_npmVersion":"10.9.2","description":"CLI to easily manage and switch between multiple Git accounts","directories":{},"_nodeVersion":"23.10.0","dependencies":{"chalk":"^5.6.2","commander":"^14.0.3","@inquirer/prompts":"^8.3.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/git-manager_1.0.1_1775183817169_0.1490631503160742","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@anhducmata/git-manager","version":"1.0.2","keywords":["git","git-account","git-switch","ssh","ssh-key","multiple-accounts","git-manager","git-profile","cli"],"author":"","license":"ISC","_id":"@anhducmata/git-manager@1.0.2","maintainers":[{"name":"anhducmata","email":"anhducmata@gmail.com"}],"bin":{"gitm":"index.js"},"dist":{"shasum":"51206e4e85a5d93a685985f2b2d5e020128bee24","tarball":"https://registry.npmjs.org/@anhducmata/git-manager/-/git-manager-1.0.2.tgz","fileCount":3,"integrity":"sha512-2bM4Wz7ptkmdDQ8E9jf/9Sxf/EUeZgpZwMAyC9s7lTUjYD7BVfoO0t3L5XAebDRhCisMTovdllkud8pF1YcbBg==","signatures":[{"sig":"MEUCIQCSx/GIueu0d2jd/JP02X2liW1S0sh3yqvQ8t4OUo/c0AIgLcasepCeJgrFi7MnEozv3NzMMsuZrjxpYuFlIHgXfsg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11767},"main":"index.js","type":"module","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"anhducmata","email":"anhducmata@gmail.com"},"_npmVersion":"10.9.2","description":"CLI to easily manage and switch between multiple Git accounts","directories":{},"_nodeVersion":"23.10.0","dependencies":{"chalk":"^5.6.2","commander":"^14.0.3","@inquirer/prompts":"^8.3.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/git-manager_1.0.2_1775183907878_0.723607744028617","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@anhducmata/git-manager","version":"1.1.1","keywords":["git","git-account","git-switch","ssh","ssh-key","multiple-accounts","git-manager","git-profile","cli"],"author":"","license":"ISC","_id":"@anhducmata/git-manager@1.1.1","maintainers":[{"name":"anhducmata","email":"anhducmata@gmail.com"}],"bin":{"gitm":"index.js"},"dist":{"shasum":"a5d6a3d4dd6c2bacbfeb4c07b99f8f1b8825def7","tarball":"https://registry.npmjs.org/@anhducmata/git-manager/-/git-manager-1.1.1.tgz","fileCount":3,"integrity":"sha512-2RxvqXZDxxonGCa1drg5TnBpYtrwpwLx6yhukgsbLyJXfCtH137P1JD6wc3KZO1M6/L/k5UrNIrKWY1Ot2khXg==","signatures":[{"sig":"MEQCIEIi/inyNc+EiDuNdyDhq3pdo2FEk2pJX3QPvoR2KgtgAiAyz9DAgDQhketazNJUBi1rcBiP82YDP0rktPrz7OXaVA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14369},"main":"index.js","type":"module","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"anhducmata","email":"anhducmata@gmail.com"},"_npmVersion":"10.9.2","description":"CLI to easily manage and switch between multiple Git accounts","directories":{},"_nodeVersion":"23.10.0","dependencies":{"chalk":"^5.6.2","commander":"^14.0.3","@inquirer/prompts":"^8.3.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/git-manager_1.1.1_1775185196385_0.5821585403382816","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@anhducmata/git-manager","version":"1.1.2","description":"CLI to easily manage and switch between multiple Git accounts","main":"index.js","type":"module","bin":{"gitm":"index.js"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["git","git-account","git-switch","ssh","ssh-key","multiple-accounts","git-manager","git-profile","cli"],"author":"","license":"ISC","dependencies":{"@inquirer/prompts":"^8.3.2","chalk":"^5.6.2","commander":"^14.0.3"},"_id":"@anhducmata/git-manager@1.1.2","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-YVDiAcNd2TkzyMwDkgfEEaWh8jNxrqSeRR52BYhDPo4VibldGJVihTaYclkoQZ8yIqiRkgaAor77Ud/72B06yw==","shasum":"23ff46da53a1150a90d8703b823f6fcd97c3abee","tarball":"https://registry.npmjs.org/@anhducmata/git-manager/-/git-manager-1.1.2.tgz","fileCount":6,"unpackedSize":23205,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEj9ogwS/72Fy8zCWpCuDpXIIWwibsZdYNYYsAEc/zs2AiBwaubUw8k4TJl0bxQjG42EkFdreJiiqUQR3xVGu0mTTw=="}]},"_npmUser":{"name":"anhducmata","email":"anhducmata@gmail.com"},"directories":{},"maintainers":[{"name":"anhducmata","email":"anhducmata@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/git-manager_1.1.2_1781615258795_0.8477936120475174"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-03T02:34:07.493Z","modified":"2026-06-16T13:07:39.081Z","1.0.0":"2026-04-03T02:34:07.785Z","1.0.1":"2026-04-03T02:36:57.304Z","1.0.2":"2026-04-03T02:38:28.015Z","1.1.1":"2026-04-03T02:59:56.528Z","1.1.2":"2026-06-16T13:07:38.950Z"},"license":"ISC","keywords":["git","git-account","git-switch","ssh","ssh-key","multiple-accounts","git-manager","git-profile","cli"],"description":"CLI to easily manage and switch between multiple Git accounts","maintainers":[{"name":"anhducmata","email":"anhducmata@gmail.com"}],"readme":"# @anhducmata/git-manager\n\n> Instantly switch between multiple Git accounts (SSH keys + user config) on a single machine.\n\nIf you use **multiple GitHub/GitLab accounts** on one laptop (e.g. Work + Personal), this CLI tool lets you switch between them in seconds — including the SSH key, so `git push` always goes to the right account.\n\n---\n\n## ✨ Features\n\n- **Per-repo config** — `gitm init` sets the account locally for each repo (recommended)\n- **Global switch** — `gitm switch` changes the global config when you need it\n- **Auto-generates SSH keys** — creates a dedicated `ed25519` key per profile\n- **No more SSH conflicts** — uses `core.sshCommand` with `IdentitiesOnly=yes` so Git always uses the correct key\n- **Interactive prompts** — no flags to memorize, just follow the menu\n- **Lightweight** — zero config files to edit manually\n\n---\n\n## 📦 Installation\n\n```bash\nnpm install -g @anhducmata/git-manager\n```\n\nAfter installing, the `gitm` command is available globally.\n\n---\n\n## 🚀 Quick Start\n\n### 1. Add your first account\n\n```bash\ngitm new\n```\n\nYou'll be asked for:\n- **Profile name** — a label like `Work` or `Personal`\n- **Git user.name** — the name that appears on your commits\n- **Git user.email** — the email tied to your Git provider\n- **SSH key** — press Enter to auto-generate a new `ed25519` key, or provide a path to an existing one\n\nAfter the key is generated, the tool prints your **public key** so you can copy it into GitHub/GitLab:\n\n```\nssh-ed25519 AAAAC3Nza... your-email@example.com\n```\n\n> 💡 Add this key to your Git provider:\n> - **GitHub**: Settings → SSH and GPG keys → New SSH key\n> - **GitLab**: Preferences → SSH Keys → Add new key\n\n### 2. Add your second account\n\n```bash\ngitm new\n```\n\nRepeat the same process for your other account (e.g. `Personal`).\n\n### 3. Set account per repo (recommended)\n\n```bash\ncd ~/projects/work-project\ngitm init\n```\n\nThis sets the Git user + SSH key **locally** for that repo only. Other repos are not affected.\n\n### 4. Or switch globally\n\n```bash\ngitm switch\n```\n\nThis changes the global Git config — useful when you want to quickly switch everything at once.\n\n---\n\n## 📖 Commands\n\n| Command | Description |\n|---|---|\n| `gitm new` | Add a new Git account with SSH key |\n| `gitm init` | Set account for current repo (local config) |\n| `gitm switch` | Switch global git account |\n| `gitm list` / `gitm ls` | Show all saved accounts + current active user |\n| `gitm remove` | Remove a saved account (optionally delete its SSH key) |\n| `gitm --help` | Show help |\n\n---\n\n## 🔧 How It Works\n\n`gitm init` (local, per-repo) and `gitm switch` (global) both do the same three things:\n\n```bash\n# 1. Set Git identity\ngit config [--local|--global] user.name \"Your Name\"\ngit config [--local|--global] user.email \"your@email.com\"\n\n# 2. Force Git to use the correct SSH key\ngit config [--local|--global] core.sshCommand \"ssh -i ~/.ssh/id_ed25519_gm_work -o IdentitiesOnly=yes\"\n```\n\n> 💡 **Tip:** Use `gitm init` per repo so each project is permanently tied to the right account. Use `gitm switch` only when you need a quick global change.\n\nThe `IdentitiesOnly=yes` flag is critical — it tells SSH to **only** use the specified key and ignore any other keys loaded in your SSH agent. This prevents the common problem where `git push` uses the wrong account.\n\n---\n\n## 📁 Where Data Is Stored\n\n| Path | Contents |\n|---|---|\n| `~/.config/git-manager/accounts.json` | Your saved profiles |\n| `~/.ssh/id_ed25519_gm_<profile>` | Auto-generated SSH private keys |\n| `~/.ssh/id_ed25519_gm_<profile>.pub` | Auto-generated SSH public keys |\n\n---\n\n## ❓ FAQ\n\n### Can I use an existing SSH key instead of generating a new one?\n\nYes! When `gitm new` asks for the SSH key path, just type the full path to your existing key instead of pressing Enter:\n\n```\n? Enter SSH key path: /Users/you/.ssh/id_rsa\n```\n\n### Should I use `gitm init` or `gitm switch`?\n\nUse `gitm init` — it sets config **locally** per repo, so each project always uses the correct account. Use `gitm switch` only when you need a quick global change and don't want to configure each repo individually.\n\n### What if I already have `~/.ssh/config` set up?\n\nThis tool uses `core.sshCommand` which overrides `~/.ssh/config` for Git operations. Your SSH config still works for non-Git SSH connections (like `ssh myserver`).\n\n---\n\n## 🤝 Contributing\n\nPRs welcome! Feel free to open issues or submit pull requests.\n\n## 📄 License\n\nISC\n","readmeFilename":"README.md"}