npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@anhducmata/git-manager

v1.1.1

Published

CLI to easily manage and switch between multiple Git accounts

Downloads

460

Readme

@anhducmata/git-manager

Instantly switch between multiple Git accounts (SSH keys + user config) on a single machine.

If 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.


✨ Features

  • Per-repo configgitm init sets the account locally for each repo (recommended)
  • Global switchgitm switch changes the global config when you need it
  • Auto-generates SSH keys — creates a dedicated ed25519 key per profile
  • No more SSH conflicts — uses core.sshCommand with IdentitiesOnly=yes so Git always uses the correct key
  • Interactive prompts — no flags to memorize, just follow the menu
  • Lightweight — zero config files to edit manually

📦 Installation

npm install -g @anhducmata/git-manager

After installing, the gitm command is available globally.


🚀 Quick Start

1. Add your first account

gitm new

You'll be asked for:

  • Profile name — a label like Work or Personal
  • Git user.name — the name that appears on your commits
  • Git user.email — the email tied to your Git provider
  • SSH key — press Enter to auto-generate a new ed25519 key, or provide a path to an existing one

After the key is generated, the tool prints your public key so you can copy it into GitHub/GitLab:

ssh-ed25519 AAAAC3Nza... [email protected]

💡 Add this key to your Git provider:

  • GitHub: Settings → SSH and GPG keys → New SSH key
  • GitLab: Preferences → SSH Keys → Add new key

2. Add your second account

gitm new

Repeat the same process for your other account (e.g. Personal).

3. Set account per repo (recommended)

cd ~/projects/work-project
gitm init

This sets the Git user + SSH key locally for that repo only. Other repos are not affected.

4. Or switch globally

gitm switch

This changes the global Git config — useful when you want to quickly switch everything at once.


📖 Commands

| Command | Description | |---|---| | gitm new | Add a new Git account with SSH key | | gitm init | Set account for current repo (local config) | | gitm switch | Switch global git account | | gitm list / gitm ls | Show all saved accounts + current active user | | gitm remove | Remove a saved account (optionally delete its SSH key) | | gitm --help | Show help |


🔧 How It Works

gitm init (local, per-repo) and gitm switch (global) both do the same three things:

# 1. Set Git identity
git config [--local|--global] user.name "Your Name"
git config [--local|--global] user.email "[email protected]"

# 2. Force Git to use the correct SSH key
git config [--local|--global] core.sshCommand "ssh -i ~/.ssh/id_ed25519_gm_work -o IdentitiesOnly=yes"

💡 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.

The 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.


📁 Where Data Is Stored

| Path | Contents | |---|---| | ~/.config/git-manager/accounts.json | Your saved profiles | | ~/.ssh/id_ed25519_gm_<profile> | Auto-generated SSH private keys | | ~/.ssh/id_ed25519_gm_<profile>.pub | Auto-generated SSH public keys |


❓ FAQ

Can I use an existing SSH key instead of generating a new one?

Yes! When gitm new asks for the SSH key path, just type the full path to your existing key instead of pressing Enter:

? Enter SSH key path: /Users/you/.ssh/id_rsa

Should I use gitm init or gitm switch?

Use 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.

What if I already have ~/.ssh/config set up?

This tool uses core.sshCommand which overrides ~/.ssh/config for Git operations. Your SSH config still works for non-Git SSH connections (like ssh myserver).


🤝 Contributing

PRs welcome! Feel free to open issues or submit pull requests.

📄 License

ISC