
How to Use Multiple GitHub Accounts on One Machine (Work + Personal) Using SSH
Struggling with Permission denied (publickey) when switching GitHub accounts? This guide shows you how to configure multiple GitHub accounts using SSH keys, host aliases, and automatic Git identity switching . Set it up once. It works forever. 🚀 Quick Setup (TL;DR) If you already understand SSH basics, here’s the entire flow: # 1. Create two SSH keys ssh-keygen -t ed25519 -C "work@company.com" -f ~/.ssh/id_ed25519_work ssh-keygen -t ed25519 -C "personal@email.com" -f ~/.ssh/id_ed25519_personal # 2. Configure SSH aliases # ~/.ssh/config Host github-work HostName github.com User git IdentityFile ~/.ssh/id_ed25519_work Host github-personal HostName github.com User git IdentityFile ~/.ssh/id_ed25519_personal # 3. Clone using aliases git clone git@github-work:org/repo.git git clone git@github-personal:user/repo.git 👉 If this makes sense, you’re done 👉 If not, continue for the full breakdown The Problem You have: One work GitHub account One personal GitHub account But SSH only sees: github.c
Continue reading on Dev.to
Opens in a new tab



