Generate SH1 Keys on MacOS

Generate SH1 Keys on MacOS

Colin Stodd
SSH,Key Pair,MacOS,SH1
11 Mar 2020 (Published)
11 Mar 2020 (Updated)

In order for you to be able to connect to your Github account or to SSH into applications you are going to be required to generate an SH1 key.

Here is how you generate SSH key pairs in MacOS.

  1. Open up your favorite terminal or the default MacOS terminal: Applications > Utilities > Terminal

  2. You’ll first want to check and see if you already have an SSH key created. You can check by running this in your terminal:

     ls -al ~/.ssh

    If you see files named id_rsa and or like what’s in the image below

id_rsa screenshot

This means a key has already been created in it’s default location (Yay, less work!), so you can use that key (see how use below) or you can generate a new one.

If you don’t see those files, then you’ll want to generate a new key. For something such as CPanel, start in the next section.

If all you need to do is add your key to GitHub then Scroll down for instructions.

  1. For cPanel you’ll want to run this in your terminal and the press the return key:

     ssh-keygen -t rsa
  2. You will now be prompted to tell the the prompt where you want your key be placed/located. If you leave it blank and press return key, it will place the key in it’s default location (Recommended). If you decide to place the key in a different location, just remember to make a note of where you place your key. If you leave it blank and press return it will place your key in:


  3. Now you will be prompted to enter a password to access the key (Note: The password is not required, you can leave blank and press return). Also, note that you will not see the characters when you are typing the password. This is for your own safety.

  4. After you press return, your SSH key will have been created and located in:


  5. Depending on what you are using the passkey for you can upload/use by going into something like C Panel or Github by using this command:

ssh-add /home/user/.ssh/id_rsa


  1. For GitHub you’ll want to open your terminal app and run the following command (but with your Github account email address):

    ssh-keygen -t rsa -b 4096 -C ""

    This creates a new ssh key with your_github_email address.

  2. Now you’ll be asked where you want to save your key (I recommend that you leave this blank to have it placed in your default location):

     (/Users/yourUsername/.ssh/id_rsa): [Press return]
  3. Next, a prompt will ask for a passphrase/password. Again, this is optional and you won’t be able to see the password you type.

    Enter passphrase (empty for no passphrase): typePasswordHere
    Enter same passphrase again: typeSamePasswordAgain

Adding your SSH key to the ssh-agent

Much of the remaining two sections were taken directly from the GitHub help pages. I'm lazy and they explain things better, but I wanted to combine their work with the stuff I added above for ease-of-access.

Important note from Github Docs: 1

Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key. When adding your SSH key to the agent, use the default macOS ssh-add command, and not an application installed by macports, homebrew, or some other external source.

  1. Start the ssh-agent in the background:
     eval "$(ssh-agent -s)"
     > Agent pid 59566
  2. If you’re using macOS Sierra 10.12.2 or later, you will need to modify your ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain. Open using VSCode:

     code ~/.ssh/config
  3. Update the ~/.ssh/config:

     Host *
     AddKeysToAgent yes
     UseKeychain yes
     IdentityFile ~/.ssh/id_rsa
  4. Add your SSH private key to the ssh-agent and store your passphrase in the keychain. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file:
     ssh-add -K ~/.ssh/id_rsa

Adding Your New SSH Key To Your GitHub Account

  1. Copy the SSH key to your clipboard 1.

    If your SSH key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don’t add any newlines or whitespace.

     pbcopy < ~/.ssh/  # Copies the contents of the file to your clipboard

If pbcopy isn't working, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.

  1. In the upper-right corner of any page, click your profile photo, then click Settings:
  2. In the user settings sidebar, click SSH and GPG keys:
  3. Click New SSH key or Add SSH key:
  4. In the “Title” field, add a descriptive label for the new key. For example, if you’re using a personal Mac, you might call this key “Personal MacBook Air”.

  5. Paste your key into the “Key” field:
  6. Click Add SSH key:
  7. If prompted, confirm your GitHub password:

And you should now be good to go. I hope you found this article useful, if so, please leave a comment or Disqus Response below so that I know how things things went for you.


  1. GitHubPages  2