Search code examples
gitgithubgit-bashssh-keys

Is it possible to have 2 (or more) GitHub accounts, 2 (or more) ssh key in one computer?


The thing is me and my brother both engaged in programming and we just learned about GitHub (and similar repository sites) but we have only one computer in the house so my question is:

Is it possible the I can have 2 (or more) ssh key for 2 (or more) GitHub accounts?

If I have 2 accounts on GitHub and I created a ssh key on both account will the ssh key of 2nd account overwrites the ssh key of the first?


Solution

  • $HOME/.ssh/config

    Host dev
        HostName dev.example.com
        Port 22000
        User fooey
    Host github.com
        IdentityFile ~/.ssh/github.key
    

    https://www.ssh.com/ssh/config/

    Otherwise use the same ssh key for both users ...