How to add SSH keys in GitLab ?

When you want to write something to gitlab repositories, you must need to add your development machines SSK keys in GitLab settings so as you are authorised to push the code changes to projects.

If you don’t know how to create SSH keys in Ubuntu, follow the steps from “How to create SSH Keys in Ubuntu / Linux ?” and create your SSH keys.

Once you created SSH keys, you need to login to your GitLab account, click on your user profile from top right (1), then Edit Profile (2), from left side bar click on “SSH Keys” , copy the contents of /home/your_user/.ssh/id_ras.pub and paste into Key (4) and click on “Add key” (5) as shown in below image.

Once you added the SSH key, you can use below command to verify that you are now authenticated to access the gitlab as,

$ ssh -T git@gitlab.com
Welcome to GitLab, @lynxbee!

If everything is fine, you should see welcome message with your GitLab user name.

Leave a Comment