Getting started with GitLab

gitlab-logo

This post is a getting started guide for GitLab. GitLab is described as a Single application for the entire DevOps lifecycle. It allows you to centralize your code in git repositories and create ci cd pipelines as code.

You can learn more about what GiLab has to offer here.

The following steps will walk through how to create a GitLab account, creating a GitLab project (repo) and pushing code to your project.

 

Steps

  1. First go to gitlab.com
    Look for the register button in the top right corner and click it.
    Getting started with GitLab-000022
  2. Fill in the registration form and click register or use one of the other registration options such as register with Google.
    Getting started with GitLab-000023
  3. Once registered you will be presented with a welcome screen like the following.
    Getting started with GitLab-000024
  4. Click the Create a project option. Repositories are created within projects.

    Getting started with GitLab-000025

  5. You will be presented with a number of options here. I am going to create a blank project called djangoApp and make it public.

    Getting started with GitLab-000027

    When you are happy with the new project settings click Create project.

  6. Once your project is created you will a couple of warnings related to ssh keys and an account password. To resolve these issues we will need to create an ssh key on our local machine and add it to our GitLab account. Also we will need to set a password on our account.

    gitlab warning

  7. To add an ssh key to your account you will need to click on your user icon in the top right of the screen. Then click on settings.

    Getting started with GitLab-000030
    Then in the menu on the left, click on ssh keys.

    Getting started with GitLab-000031

    I am working on an Ubuntu system and have an ssh key already in place.

    Getting started with GitLab-000032

    I will run the the following command to get the content of my key file.

    cat id_rsa.pubIf you do not have any ssh keys in place you will need to create them. Follow the GitLab documentation here for instructions on how to create keys for your system.

    Once you have your key, copy the content of the key to the key section of your profile and click Add Key.
    Getting started with GitLab-000033

    Your key should now be in place and you should be able to authenticate with GitLab.
    You can test everything is ok by running the following command.

    ssh -T git@gitlab.com

    You should see some thing like the following.

    Getting started with GitLab-000034

  8. Once your keys are in place you should be able to push code to your new repo.
    Go back to your project.

    Getting started with GitLab-000035
    Click into the project you created previously.
    Getting started with GitLab-000036
    You will see various instruction.

    Getting started with GitLab-000037

    First set your global settings
    Getting started with GitLab-000039
    I will follow the instructions to Push an existing folder.

    Getting started with GitLab-000038
    Now once you have pushed the code successfully you can go to the root of your project in GitLab and you should see your files in your new repository.

    Getting started with GitLab-000040Thats it for this post. GitLab is a powerfull platform and has a lot more to offer, especially in the area of ci/cd, this is something I will look at in future posts.

    If you found this post helpful, please leave a comment below.

Leave a Comment





GET IN TOUCH!

Please enter your name.
Please enter a valid phone number.
Please enter a message.

WebMe,

Killriffith,

Nenagh,

Co. Tipperary.

E45 K259

Sarah: +353 85 1715479

Office: +353 67 42443

hello@webme.ie