Skip to content
  1. Generate SSH key pair

    Terminal window
    ssh-keygen -t ed25519 -C "your_email@example.com" -f ~/.ssh/github_key
    ssh-keygen -t ed25519 -C "your_email@example.com" -f ~/.ssh/gitlab_key
    ssh-keygen -t ed25519 -C "your_email@example.com" -f ~/.ssh/azure_key
  2. Add the public keys (.pub) to your Git providers.

  3. Add the key to ~/.ssh/config:

    # github - my account
    Host github.com
    AddKeysToAgent yes
    UseKeychain yes
    IdentityFile ~/.ssh/github_key
    # gitlab - my account
    Host gitlab.com
    AddKeysToAgent yes
    UseKeychain yes
    IdentityFile ~/.ssh/gitlab_key
    # azure - my acount
    Host ssh.dev.azure.com
    AddKeysToAgent yes
    UseKeychain yes
    IdentityFile ~/.ssh/azure_key
  4. Add keys to keychain

    Terminal window
    ssh-add --apple-use-keychain ~/.ssh/github_key
    ssh-add --apple-use-keychain ~/.ssh/gitlab_key
    ssh-add --apple-use-keychain ~/.ssh/azure_key
  5. Test connection

    Terminal window
    ssh -T git@github.com
    ssh -T git@gitlab.com
    ssh -T git@ssh.dev.azure.com