Today, we'll see how we can add SSH key to our GitLab account so that we can push, pull & perform tasks from our GitLab in local machine.
First, we need to have a GitLab account without any SSH key (preferred).
Now, we need to create SSL certificate. Remember, Gitlab only allows some hashing methods for this. Following is the list:
Now, we need to open Command Prompt in our local machine & enter following command:-
ssh-keygen -t ed25519 -C "YOUR_MAIL_ID"
; since I want to use ed25519 hashing algo, I've used that. For others, use those names.
Then, just press enter for the prompts, for simplicity, it'll ask for the filename & any passphrase we wanna use.
Keys will be generated after you press enter. It'll look like this :-
Now, files will be generated like below :-
You open the file with extension .pub just generated & copy whole file content.
Go to the SSL page in Gitlab & click on Add new Key button
In the SSL content, paste the key copied from file.
Put other details as needed & click on Add Key button.
Your key will be added successfully with other SSH key & fingerprint details.
Now, just to check your gitlab is connected to your local machine, put below command & press Enter :-
ssh -vT git@gitlab.com
You must see a message 'Welcome to Gitlab, [YOUR_USERNAME]!' in the screen along with some other details.
Feel free to reach out to me via LinkedIn, Instagram or checkout my Portfolio.
HAPPY HACKING !!!
Top comments (0)