How to view existing SSH keys on Mac

Posted on: September 19th, 2022
By: Tadeo Martinez

This will list all the SSH keys (if you have more than one)

ls -al ~/.ssh

Here’s how to view the content of the SSH key

cat ~/.ssh/id_rsa.pub

To generate a new key. Add a password so the key works with GitHub. Here’s how to add the key to GitHub.

ssh-keygen

I’m unsure if this is needed, but run these two commands to set your agent. Most likely the name of key is id_rsa but if it isn’t make sure to update to the proper name.

eval "$(ssh-agent -s)"

ssh-add ~/.ssh/id_rsa

To add new a key, you can specify a different name by entering the file path:

/Users/name/.ssh/name_of_key

The first “name” will already be determined by the user in your Mac, you will need to specify “name_of_key” so it’s saved a new key that you can use later.

Have any questions or comments? Write them below!


Leave a Reply

Your email address will not be published. Required fields are marked *