Managing Dual GitHub Accounts on a Single Windows Laptop

A Simple Web Developer & Designer
Working with multiple GitHub accounts on a single machine can be confusing, especially when SSH keys, GitHub Desktop and global Git configurations interact. Today, we solved a full dual-account setup scenario for a Windows laptop. Here’s the full documented workflow with example accounts (emails and usernames anonymized).
1. Understanding the Problem
Personal account:
personal-user(email:personal@example.com)Work account:
work-user(email:work@example.com)GitHub Desktop was logged in only with personal account.
Git Bash kept prompting to select an account.
Multiple SSH keys existed and some paths were misconfigured.
Goals:
Personal account should be primary.
Work account should also be available.
SSH connections should work for both accounts without repeated prompts.
GitHub Desktop should respect the correct account per repo.
2. Resetting Git Global Identity
git config --global user.name "personal-user"
git config --global user.email "personal@example.com"
git config --global --list
This ensures all new repositories default to personal account.
3. Generating Separate SSH Keys
Personal Key
ssh-keygen -t ed25519 -C "personal@example.com" -f "/c/Users/username/.ssh/id_ed25519_personal"
Work Key
ssh-keygen -t ed25519 -C "work@example.com" -f "/c/Users/username/.ssh/id_ed25519_work"
4. Configuring SSH Agent
eval "$(ssh-agent -s)"
ssh-add /c/Users/username/.ssh/id_ed25519_personal
ssh-add /c/Users/username/.ssh/id_ed25519_work
ssh-add -l
Check that both keys are listed.
5. Setting Up SSH Config
Create a config file at ~/.ssh/config (no extension):
# Personal account (default)
Host github.com
HostName github.com
User git
IdentityFile /c/Users/username/.ssh/id_ed25519_personal
IdentitiesOnly yes
# Work account
Host github-work
HostName github.com
User git
IdentityFile /c/Users/username/.ssh/id_ed25519_work
IdentitiesOnly yes
Important: Use forward slashes and correct
/c/Users/...paths for Git Bash.
6. Adding SSH Keys to GitHub
Personal account
Log in to
personal-user→ GitHub SSH KeysClick New SSH key → title
Personal LaptopPaste
/c/Users/username/.ssh/id_ed25519_personal.pub
Work account
Log in to
work-user→ GitHub SSH KeysClick New SSH key → title
Work LaptopPaste
/c/Users/username/.ssh/id_ed25519_work.pub
Remove any old/unused keys to avoid conflicts.
7. Testing SSH Connections
ssh -T git@github.com # Personal account
ssh -T git@github-work # Work account
Expected output:
Hi personal-user! You've successfully authenticated...
Hi work-user! You've successfully authenticated...
8. Repository Workflow
Cloning
- Personal repo:
git clone git@github.com:personal-user/personal-repo.git
- Work repo:
git clone git@github-work:work-user/work-repo.git
Local Git Identity per Repo
Inside the repo folder:
- Personal repo:
git config user.name "personal-user"
git config user.email "personal@example.com"
- Work repo:
git config user.name "work-user"
git config user.email "work@example.com"
Pushing Changes
git add .
git commit -m "Your commit message"
git push origin main
Git automatically selects the correct SSH key based on the host alias.
9. GitHub Desktop Guidelines
Keep Desktop logged in with personal account.
For work repos, ensure the remote URL uses
github-workalias.Desktop respects the remote URL and will use the correct SSH key.
Local Git identity ensures commits are attributed correctly.
For shared repos, always use SSH alias for the account you’re committing as.
Remove old credentials from Windows Credential Manager to avoid HTTPS prompts.
10. Rules
Default identity = personal (global Git + SSH default host).
Work account = use
github-workSSH alias + local repo identity.All shared repositories = always clone/push using the SSH alias of the account you’re committing as.
GitHub Desktop will respect the remote URL; no need to switch Desktop login.
Keep
.ssh/configcorrect, forward-slash paths, and no file extension.
Result: Fully working dual-account GitHub setup on a single Windows laptop, clean, reliable, and avoids prompts.
