Skip to content

Instantly share code, notes, and snippets.

@adpro
Last active June 16, 2020 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adpro/0ffe0ecfb22867b9cfbe8b984fe8548a to your computer and use it in GitHub Desktop.
Save adpro/0ffe0ecfb22867b9cfbe8b984fe8548a to your computer and use it in GitHub Desktop.

Generate new SSH keys

Steps

  • ssh-keygen -t rsa -b 4096 -f id_rsa_personal -C "adpro@personal.mail"

  • copy to Keypass

  • ssh-keygen -t rsa -b 4096 -f id_rsa_work -C "adpro@work.mail"

  • copy to Keypass

  • touch known_hosts_personal

  • touch known_hosts_work

  • touch config

    Host github.com
        HostName github.com
        User git
        IdentityFile ~/.ssh/id_rsa_personal
        UserKnownHostsFile ~/.ssh/known_hosts_personal
        IdentitiesOnly yes
        UseKeychain yes
        AddKeysToAgent yes
    
    Host ssh.dev.azure.com
        HostName ssh.dev.azure.com
        User git
        IdentityFile ~/.ssh/id_rsa_work
        UserKnownHostsFile ~/.ssh/known_hosts_work
        IdentitiesOnly yes
        UseKeychain yes
        AddKeysToAgent yes
    
    Host vs-ssh.visualstudio.com
        HostName vs-ssh.visualstudio.com
        User adler-it
        IdentityFile ~/.ssh/id_rsa_work
        UserKnownHostsFile ~/.ssh/known_hosts_work
        IdentitiesOnly yes
        UseKeychain yes
        AddKeysToAgent yes
  • verify 664 for id_rsa*

  • ssh-add -K id_rsa_personal

  • ssh-add -K id_rsa_work

  • verify added keys ssh-add -l

  • copy public keys to services pbcopy < id_rsa_personal.pub

  • insert info SSH keys in services

  • pbcopy < id_rsa_work.pub

  • insert info SSH keys in services

Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment