Skip to content

Create ssh key pair

You need to create an ssh key pair on the machine from which you want to interact with a GitLab repo. Concretely,

  1. Enter the .ssh subdirectory under your $HOME: cd $HOME/.ssh. (Note that .ssh is a hidden directory and will not be visible under your $HOME by default.)
  2. Run ssh-keygen -t rsa -b 4096 after reading the following sub bullets:
    • The set of output, including prompts and responses from you, from running ssh-keygen... should look something like the following:
      [janeh@izgw3:.ssh]$ ssh-keygen -t rsa -b 4096
      Generating public/private rsa key pair.
      Enter file in which to save the key (/home/janeh/.ssh/id_rsa):
      Enter passphrase (empty for no passphrase):
      Enter same passphrase again:
      Your identification has been saved in /home/janeh/.ssh/id_rsa.
      Your public key has been saved in /home/janeh/.ssh/id_rsa.pub.
      The key fingerprint is:
      SHA256:VhTID8JrMqVejFFz1wMwqvj5o0kyYobWuExST97BeQQ janeh@izgw3
      The key's randomart image is:
      +---[RSA 2048]----+
      |     oE.+o=+     |
      |    . +=++  o    |
      |     *.o.o.  .   |
      |   .=o=o ..      |
      |  o.o=+ S        |
      |..o=.o +         |
      |+*o.* .          |
      |B..+ o.          |
      | o  o...         |
      +----[SHA256]-----+
      
    • Note that you will first be asked for a filename. The default should be something like $HOME/.ssh/id_rsa. Accept this default by hitting Enter.
    • Note that you will next be asked for a passphrase. Do NOT enter a passphrase. Skip this step by hitting Enter. Hit Enter a second time when asked to confirm your passphrase.
    • The names of the files created and a bit of keyart will then be printed to standard out. You don’t need to do anything with the keyart.
  3. After running ssh-keygen -t rsa -b 4096 and responding to the ensuing prompts, check that id_rsa and id_rsa.pub exist in your $HOME/.ssh directory.