· Astro  · 1 min read

Git SSH Credentials in macOS

How to register SSH credentials

  1. Create a key pair and register the public key in git.

  2. 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 azure.com
    AddKeysToAgent yes
    UseKeychain yes
    IdentityFile ~/.ssh/azure_key
  3. Permanently register key

    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
  4. Test

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

Related Posts

View All Posts »

Links

Useful links and information other people wrote so I don't have to.

Read more