Skip to content
Lucian Cumpata edited this page Jun 23, 2020 · 3 revisions

Welcome on my GitLab journey

Initial setup steps

  • Have an account and project on gitlab.com

We will skip this step as it's self explanatory and very easy to do.

  • Setup your SSH keys (mandatory for private projects/repos)

I use Windows 10 as my OS, so we will use WSL (Windows Subsystem for Linux) to create an SSH keys pair for gitlab.

  1. Check your SSH version

ssh -V

If you get:

-bash: ssh: command not found

You must install SSH on your machine:

sudo apt-get update

sudo apt-get install openssh-server

  1. Generate keys

We will generate and configure ED25519 key because it's considered more secure and performant than RSA keys.

ssh-keygen -t ed25519 -C "<comment>"

This will generate two keys: one public and one private. The public key you must add to gitlab:

User-settings -> SSH keys

Add the public key here!

  1. Configure keys

Copy the private key to /.ssh folder and change permissions:

chmod 400 example_key

Also run the following commands:

eval $(ssh-agent -s)

nano config and copy paste the following configurations:

# GitLab.com

Host gitlab.com

Preferredauthentications publickey

IdentityFile ~/.ssh/example_key

Also change the permissions for config file:

chomd 600 ~/.ssh/config

  1. Test and clone the repo

Run ssh -T git@gitlab.com and type yes to add GitLab.com to the list of trusted hosts

Then run the above command again, and it should return you an

A successful run should return Welcome to GitLab, @username!

Now you should be able to git clone your repo

Reference: https://gitlab.com/help/ssh/README#generating-a-new-ssh-key-pair

Clone this wiki locally