How to setup multiple ssh keys for different github repos

Create key and add it to github Create ssh key: ssh-keygen -t ed25519 -C "your_email@example.com" Add your key to agent: ssh-add ~/.ssh/elvinguti_key Add key to github. Update config Update ~/.ssh/config: Host github.com HostName github.com IdentityFile ~/.ssh/my_work_key IdentitiesOnly yes Host elvinguti.github.com HostName github.com User elvinguti IdentityFile ~/.ssh/elvinguti_key IdentitiesOnly yes you might need to restart the ssh-agent: eval $(ssh-agent -s) Then you should be able to clone a repo or update the git remote url:...

April 12, 2024 · 1 min · Elvin Guti