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

easy-git-account-switch

v1.0.8

Published

Easily switch between multiple GitHub accounts from the command line.

Readme

🔁 GitHub Account Switcher

Easily switch between multiple GitHub accounts (like personal and work) from the command line — without GUI prompts or credential headaches.


📦 Installation

Install the CLI tool globally via npm:

npm install -g easy-git-account-switch

Once installed, use it anywhere via:

easy-git-account-switch

✨ Features

  • One command to switch accounts
  • Stores tokens securely
  • Disables GUI prompts (askpass)
  • Uses HTTPS (no SSH keys needed)
  • Works with private and public repos
  • Global CLI, no setup hassles

🚀 How It Works

This tool:

  • Sets the global Git username and email
  • Stores a personal access token (PAT) securely in ~/.git-credentials
  • Uses external config files to manage multiple accounts
  • Prevents Git from triggering GUI prompts (askpass)
  • Authenticates via GitHub API to verify your token
  • Lists local Git repos and shows remotes

🛠️ Setup Instructions

1. Create GitHub Personal Access Tokens


2. Create Token File

Create a file at:

~/.github_tokens

Example content:

personal=ghp_exampleTokenForPersonal
work=ghp_exampleTokenForWork

3. Create Account Config File

Create a file at:

~/.github_accounts

Example content:

# Format: account=username,email
personal=your-username,[email protected]
work=your-work-username,[email protected]

4. Run the CLI

Once setup is done, run:

easy-git-account-switch

You’ll see:

Select a GitHub account:
1) personal
2) work
#?

🔒 Security Note

These files contain secrets:

  • ~/.github_tokens
  • ~/.github_accounts
  • ~/.git-credentials

Make sure they're protected:

chmod 600 ~/.github_tokens ~/.github_accounts ~/.git-credentials

Never commit them to any repository.


🧼 Troubleshooting

| Issue | Solution | |-------------------------------|---------------------------------------------------------------------------| | Still asked for credentials | Ensure credentials are for https://github.com, and askpass is disabled | | 403 error | Token might not have repo access, or wrong account selected | | GUI prompt shows up | Run the CLI again to re-apply Git config |


✅ Example Usage

$ easy-git-account-switch
Select a GitHub account:
1) personal
2) work
#? 2

✅ Switched to 'work' account globally!
✅ Authentication successful!

🔗 Works With

  • ✅ Any GitHub repo using HTTPS
  • ✅ Personal or organization-owned repos
  • ✅ Multiple GitHub accounts

❌ SSH remote URLs are not supported in this version.


⚡ Troubleshooting: command not found

If you installed the package globally but get:

bash: easy-git-account-switch: command not found

it usually means your system PATH does not include the global npm binaries folder.

1. Find the npm global install path

Run:

npm prefix -g

On Windows, this is usually:

C:\Users\<YourName>\AppData\Roaming\npm

2. Add npm bin to PATH

🔹 Git Bash (Windows)

Edit your ~/.bashrc (or ~/.bash_profile) and add:

export PATH="/c/Users/<YourName>/AppData/Roaming/npm:$PATH"

Reload:

source ~/.bashrc

Tip: In Git Bash, npm sometimes installs executables as easy-git-account-switch.cmd.
Once your PATH is set correctly, you can still run it simply as:

easy-git-account-switch

🔹 PowerShell / CMD (Windows)

Add this folder to your System Environment PATH:

C:\Users\<YourName>\AppData\Roaming\npm

Then restart your terminal.

Tip: In CMD/PowerShell, if you see both easy-git-account-switch and easy-git-account-switch.cmd in that folder, just use:

easy-git-account-switch

— Windows automatically resolves the .cmd extension.


🔹 macOS / Linux

Usually npm puts binaries into /usr/local/bin (already in your PATH).
If not, add:

export PATH="$(npm prefix -g)/bin:$PATH"

to your ~/.bashrc or ~/.zshrc.


3. Verify

Run:

easy-git-account-switch

If it works, you’re good to go 🎉


Happy switching! 🔁