How to create an SSH key in Gitlab?

Hello my folks, welcome to the fascinating world of Gitlab. Nowadays, this has become a real use of every programmer/developer. You know every programmer needs some space to situate their projects and code which have been made by them. Today, in this Gitlab mainstream, we are going to elaborate on the SSH key in this you will learn about the fact of how can you create, manage with the SSH key.

What is an SSH key?

Let’s get started with SSH. SSH stands for secured shell and now, comes to the place of uses what is the use? This is used for authentication, by setting SSH you can connect to the Gitlab server without using a username and password each time. Once, you will set the SSH key so, you may skip using your username and password each time to connect your Gitlab server.

How to set up an SSH key in Gitlab?

Let see, what will have to do here?

Step 1: Run command SSH- keygen

You will have to run this command. If you are on MacBook, you can put terminal and will run the command SSH-keygen. You may enter the location or file where you have to save the key and press the enter key. So, you will have your ssh key created. This was on mac.

On mac. – run command on terminal

On windows – use putty or Git bash

If you are on windows then you can use an application or a client called putty, it is ssh client that you can use on windows or you can also use Git bash to run the command. If you will have installed it before, you will go to your windows system and search for Git bash. And you will adjust fonts if you will need them. So, you will run $ ssh-keygen then it will ask you to enter the file do you want to save it then again, you will press the enter so, it will have been created. You will go to your folder from local disk to .ssh in that two files will be created in the id_rsa and id_rsa.pub

Now, step no.2 will be

Step 2: log in to Gitlab account

                        Go to an account >> Settings >> SSH keys

So, you will go to your Gitlab and log in. you will sign in to your account if you will go to your account or profile at the top right. You would find settings there and if you will go in that. So, you will find an option for SSH key then you will click on that. You would add the content of your file id_rsa.pub. If you will go to the file and open it with any text editor like notepad and notepad++, you can copy the entire thing from there. And you will paste it to the SSH key. Suppose, you want to give a name to your key then you can add that name in the title option and switch to add key. So, you will see that everything would be edited there. There would be a key that you can use to authenticate and log in to the Gitlab server.

Now, here step no.3 is

Step 3: copy contents of id_rsa.pub and add key

Step 4: verify SSh key is added

 You have been seen. This is how you can add an SSH key to your Gitlab. I wish this all will be very useful for you.

Related video: