Copy Public SSH Key (macOS)

MD
R
Markdown

Prepare a macOS based machine to connect via SSH to network endpoints (eg. GitHub). The recipe assumes that a pair of public/private keys exists in the machine (~/.ssh)

List all SSH Identities loaded on agent

ssh-add -l

Check for Public SSH Key in the local machine

Ensure a public and private key pair exist ls -al ~/.ssh

Add your local SSH key to the ssh-agent

Start the SSH agent

eval "$(ssh-agent -s)"

OSX config

vi ~/.ssh/config

Host *
 AddKeysToAgent yes
 UseKeychain yes
 IdentityFile ~/.ssh/id_rsa

Add the Private key to SSH agent

ssh-add -K ~/.ssh/id_rsa

Copy SSH Key to clipboard

pbcopy < ~/.ssh/id_rsa.pub

Restart SSHD Service

sudo launchctl stop com.openssh.sshd

Created on 9/16/2017