DEV Community

Umesh Saini
Umesh Saini

Posted on

Stop Juggling SSH Keys: Manage Multiple Git Profiles

Stop Juggling SSH Keys: How to Manage Multiple Git Profiles

If you are a developer, chances are you’ve run into this nightmare: You just spent an hour writing an amazing feature for a client or your company. You run git commit and push it to GitHub, only to realize that you accidentally committed it using your personal user.email and it’s now permanently attached to your personal account.

Worse, you constantly get "Permission denied (publickey)" errors because your ~/.ssh/config is a mess of manual Host blocks, and your SSH agent is confused about which key to use.

For years, the standard advice for managing multiple GitHub accounts on one computer has been to manually edit your ~/.ssh/config file and use the rigid includeIf directive in your .gitconfig.

But it's 2026. Managing your Git identity shouldn't require manual file editing every time you take on a new freelance client.

The Old Way: Manual Configuration & includeIf

To switch your git identity per project the traditional way, you have to:

  1. Run ssh-keygen to manually generate a new key.
  2. Edit ~/.ssh/config to create a custom host alias (e.g., Host github-work).
  3. Manually upload the public key to GitHub.
  4. Set up folder-based routing using [includeIf "gitdir:~/work/"] in your global git config.
  5. Remember to only clone work projects into that exact folder.

If you make one typo, or clone a repository into the wrong folder, your commits get misattributed.

The New Way: DevSwitch

I built DevSwitch (an open-source desktop app and CLI) to completely automate this process. It acts as a dedicated Git account switcher and SSH key manager for macOS, Windows, and Linux.

Instead of writing config files, DevSwitch handles the heavy lifting:

  • 1-Click SSH Key Generation: Click "Add Profile", and DevSwitch automatically generates a secure ED25519 key and registers it.
  • Automatic GitHub OAuth: No more copy-pasting public keys. It authenticates with GitHub and uploads the key for you.
  • Instant Switching: Use the desktop app or type devswitch use work in the terminal. It instantly updates your global or local git config and loads the correct key into your SSH agent.
  • No Rigid Folders: You don't have to organize your projects into specific directories just to make includeIf work.

DevSwitch vs Manual SSH Config: Feature Comparison

Feature Manual ~/.ssh/config DevSwitch
Generate SSH Keys Manual (ssh-keygen) 1-Click Automated
Add to ssh-agent Manual (ssh-add) Automatic
Upload to GitHub Copy/Paste to Browser Automatic (OAuth)
Switch Identities Error Prone Instant (Desktop or CLI)

How to get started

If you are tired of dealing with git config user.name and managing SSH keys by hand, you can grab the tool for free.

💻 Download the Desktop App: devswitch.in/downloads
⌨️ Install the CLI: npm install -g devswitch-cli
Check out the source code: GitHub - DevSwitch

It’s completely open-source (MIT), stores everything locally on your machine, and never sends your private keys anywhere.

How are you currently managing your Git profiles? Let me know in the comments if you prefer the manual route or if you're ready for an automated Git identity manager!

Top comments (1)

Collapse
 
umesh_saini_52c7e55d9989b profile image
Umesh Saini

Thanks for checking out the post! Just wanted to drop in and say that while the current version handles SSH key generation and GitHub OAuth beautifully, we have some really cool stuff coming to the CLI soon (like encrypted profile backups).

If you run into any edge cases with your specific Linux or macOS setups, definitely let me know here or open an issue on GitHub!