How to generate a SSH key

Generate your SSH key on Linux and use it with Gitlab

Rphl-Mstl
2 min readNov 15, 2021

Open a shell and enter:

~ ➜ ssh-keygen Generating public/private rsa key pair.
Enter file in which to save the key (/home/rphlm/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
  • Accept the suggested filename and directory, unless you a want to save in a specific directory where you store other keys. You can also dedicate the SSH key pair to a specific host
  • Enter your passphrase
  • A confirmation is displayed, including information about where your files are stored:
Your identification has been saved in /home/user/.ssh/id_rsa
Your public key has been saved in /home/user/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:W3ma2+rUPWbomNGuRhuS2o8rpNCGH5WW2/rJYF2lb5g user@arch
The key’s randomart image is:
+ — -[RSA 3072] — — +
| |
| |
| o . |
| = + |
| o o oS.= . |
| o + o.++oX o |
| + +o+ooEo* = |
| o.+o.+oX o . |
| o*=Oo+ |
+ — — [SHA256] — — -+
  • Go to Gitlab “User Settings > SSH Key” and copy your id_rsa.pub
  • Next time you clone a repo, you’re asked for your main passphrase.
  • Save it to your keychain so it is unlocked with your session.

That’s all!

--

--

Rphl-Mstl

OS explorer, UI & UX passionate, Voxels crafter, code lover, Video Games player, Podcasts listener, Music amateur // Digital Publishing professional