Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 754 Bytes

File metadata and controls

37 lines (26 loc) · 754 Bytes

Setup SSH GitHub

  1. Create ssh config:

    # Github: user1
    Host github.com
       HostName github.com
       IdentityFile ~/.ssh/user1
       IdentitiesOnly yes
    
    # Github: user2
    Host github.user2
       HostName github.com
       IdentityFile ~/.ssh/user1
       IdentitiesOnly yes
    
  2. Generate SSH key pairs:

    ssh-keygen -t ed25519 -C "user1@gmail.com" -N Password -f .ssh/user1 ssh-keygen -t ed25519 -C "user2@gmail.com" -N Password -f .ssh/user2

  3. Edit .ssh/config file (just copy over)

  4. Add ssh keys to system: ssh-add user1 ssh-add user2

  5. Test connection:

    ssh -T git@github.com ssh -T git@github.user2

  6. Install git cli: https://github.com/cli/cli

  7. gh auth login and choose ssh method to authenticate your git accounts.