Skip to content

Generate ssh keys

Matias Barcenas edited this page Mar 14, 2018 · 3 revisions

Generate ssh keys

Using the SSH protocol, you can connect and authenticate to remote servers and services. With SSH keys, you can connect to GitHub without supplying your username or password at each visit. You can now use ssh to clone the repo and initialize all submodules.

Generate a ssh key

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Adding your SSH key to the ssh-agent

Start the ssh-agent in the background

eval "$(ssh-agent -s)"

Add key to ssh agent

ssh-add ~/.ssh/id_rsa

Add key to Github

The easiest way to copy the contents of the public key to your clipboard is to use xclip.

xclip -sel clip < ~/.ssh/id_rsa.pub

To manually copy the contents to the clipboard, do the following.

gedit ~/.ssh/id_rsa.pub # Select everything, right-click, & copy.

After:

  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.
  5. Click Add SSH key.