CodingBowl

How to Manage Two GitHub Accounts in VS Code Without Losing Your Mind

Published on 11 Apr 2026 Tech DevOps
image
Photo by Masahiro Naruse on Unsplash

Using one machine for both work and personal projects is common, but GitHub's default settings make it tricky to juggle two identities. If you've ever accidentally pushed a personal side project using your corporate email, this guide is for you.

Step 1: Separate Your SSH Keys

First, generate a unique SSH key for each account. Don't overwrite your existing one! Name them clearly, such as id_ed25519_personal and id_ed25519_work.

Next, edit your ~/.ssh/config file to define how SSH should handle different GitHub "hosts":

# Personal Account
Host github-personal
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_ed25519_personal

# Work Account
Host github-work
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_ed25519_work

Note: Ensure you've added these public keys to their respective GitHub accounts under Settings > SSH and GPG keys.

Step 2: Update Your Git Remotes

This is the "secret sauce." Instead of using the standard git@github.com, you must use the aliases you created in your SSH config.

Check your current remote:

git remote -v

Update it to point to the correct identity:

# For a personal repo
git remote set-url origin git@github-personal:username/repo.git

# For a work repo
git remote set-url origin git@github-work:org/repo.git

Step 3: Handling the VS Code Interface

While the SSH config handles the push/pull logic, the VS Code "Accounts" menu (bottom left) handles Pull Requests and Issues via the GitHub extension.

  • You can sign into both accounts simultaneously.
  • One account will be "active" at a time for extension features.
  • Switch between them as needed; your SSH settings will keep the code commits going to the right place regardless.
Pro Tip: Don't forget to set your local git config for each repo so the commit author name and email are correct:
git config user.email "your-work-email@company.com"

Meow! AI Assistance Note

This post was created with the assistance of Gemini AI and ChatGPT.
It is shared for informational purposes only and is not intended to mislead, cause harm, or misrepresent facts. While efforts have been made to ensure accuracy, readers are encouraged to verify information independently. Portions of the content may not be entirely original.

image
Photo by Yibo Wei on Unsplash