DEV Community

Cover image for Add SSH key in GitLab account
Nitin Kumar
Nitin Kumar

Posted on

Add SSH key in GitLab account

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).

No SSL certificate

Now, we need to create SSL certificate. Remember, Gitlab only allows some hashing methods for this. Following is the list:

List of hashing methods

Now, we need to open Command Prompt in our local machine & enter following command:-

ssh-keygen -t ed25519 -C "YOUR_MAIL_ID"
Enter fullscreen mode Exit fullscreen mode

; 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 :-

Generated keys

Now, files will be generated like below :-

Files generated

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
Enter fullscreen mode Exit fullscreen mode

You must see a message 'Welcome to Gitlab, [YOUR_USERNAME]!' in the screen along with some other details.

Validating github connection


Feel free to reach out to me via LinkedIn, Instagram or checkout my Portfolio.

HAPPY HACKING !!!

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay