Using Github with two accounts


  1. Create a new, separate key for each github account

    follows this tutorial:

    ssh-keygen -t ed25519 -C ""

    and follow the prompts. USE A PASSPHRASE. Or do it in one line, with filename and passphrase supplied

    ssh-keygen -t ed25519 -C "" -f /the/path/to/user1_github_key -N my_passphrase_here
    ssh-keygen -t ed25519 -C "" -f /the/path/to/user2_github_key -N my_passphrase_here
  2. Add each key to each github account


    1. Log in
    2. Go to profile–>settings–>“SSH and GPG keys”–>“Add New”
    3. Give it a name (like the filename you created) and paste in the public key
    4. Repeat adding each key to each github account
  3. Create/edit your ~/.ssh/config file

    Note: I have the following settings at the top of my config file to make it more secure:

    AddKeysToAgent yes
    Host *
       IdentitiesOnly yes
       PreferredAuthentications publickey 
       #...and other settings

    Then I add the following. To ensure the gitman package is setup correctly, make sure user1 and user2 are your actual github usernames

       User git
       IdentityFile /the/path/to/user1_github_key
       User git
       IdentityFile ~/the/path/to/user2_github_key

External References: