ghswap: Instantly Switch Between Multiple GitHub Accounts

The Problem

If you use multiple GitHub accounts—for example, one for work and one for personal projects—you’ve probably felt this pain:

  • Constantly switching git user.name and user.email
  • Swapping SSH keys manually
  • Re-authenticating GitHub CLI every time

It’s tedious, error-prone, and honestly… it shouldn’t be this hard.

The Solution — ghswap

ghswap automates everything about switching between GitHub accounts.

Once installed, just add your profiles and switch effortlessly:

npm install -g ghswap
ghswap add
ghswap work  # Instantly switches your Git setup

No more manual editing, no more broken SSH configs—just smooth, predictable switching.

Features

  • One-command switching — toggle between accounts instantly
  • Automatic SSH key management — forget manual setup
  • Directory-based auto-switching — knows which profile to use
  • 2-minute setup — get up and running in no time

How It Works

ghswap stores separate configurations for each account (like work, personal, etc.) and updates:

  • Git’s user.name and user.email
  • SSH key paths
  • GitHub CLI authentication

When you switch, it rewires everything automatically—no mistakes, no conflicts.

You can even set up directory-based auto-switching, so whenever you cd into a repo, the right GitHub account is active automatically.

Example Use Case

You have two GitHub accounts:

  • personal → for open source or side projects
  • work → for company repos

Once configured, just run:

ghswap work

Your Git config, SSH key, and GitHub CLI session now all point to your work profile. Move back to a personal repo, and ghswap can auto-detect and switch seamlessly.

Tech Stack & Availability

  • Built with Node.js
  • Works cross-platform (macOS, Linux, Windows)
  • Open source & free to use

GitHub: https://github.com/shubhamV123/ghswap

Final Thoughts

If you’re tired of manually juggling GitHub identities, give ghswap a try. It’s a simple CLI tool that saves time, context, and sanity—especially if you live in multiple GitHub worlds.

Would love your feedback, issues, or ideas on how to make it even better!

References