Skip to content

Instantly share code, notes, and snippets.

View udantha's full-sized avatar

Udantha Pathirana udantha

View GitHub Profile
@udantha
udantha / MultipleGithubAccountSSHKeys.md
Last active May 19, 2025 08:48
Git clone with multiple Github accounts in one computer

Multiple GitHub Accounts & SSH Config

A much better and a working solution than this is linked below.

https://gist.github.com/oanhnn/80a89405ab9023894df7

If you have multiple Githib accounts (ex: personal and work) using SSH keys for both accounts can be pretty cumbersome. Following is a simple way to get it done with ssh config.

Prerequists

You need to follow official github guideline to create an ssh keypair, add it to your github account and complete the steps upto "Adding your SSH key to the ssh-agent" in official guide https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent