GitLab Tutorial


This entry is part 2 of 2 in the series GitLab

In this article I assume that you have installed Git and GitLab already. We’ll loosely follow along with the YouTube tutorial by Raghav Pal. In that tutorial, in the first video, we created a GitLab account and we created a project in GitLab called My First Project. We have also created a folder on our computer called MyFirstProject and put it under a folder called GitLab. It is empty.

When I created my account at GitLab, I was able to get the username michaelporter. I had previously set up an account at GitHub where my account was “Mike Porter”. Since I will be using GitLab for a bit of time, I can execute the following command in Git Bash’s command line to make my user name michaelporter. In the second YouTube video called GitLab Beginner Tutorial 2 | Getting started with Git Commands, Raghav explains this starting at time 6:20. If you understand the command below, go ahead and run it, substituting your own name for mine.

$ git config --global user.name "michaelporter"

Do not run the above command (substituting your own user name for mine) without first running the command below and understanding why you are running them.

$ git config --global user.name

Run the following command to check your settings.

$ git config --global --list

The idea here is to create a project/folder that we can push to GitLab. As mentioned in the first paragraph of this post, we have already done that. Now we will work in either the command line in Windows, Git Bash in Windows or the terminal in Mac. In the second video, this is discussed at time 11:00. You need to go into your project folder and install Git with the following command.

git init

Git Locally

Go ahead then and work on your project locally. You can add and commit. For more information on the Git commands, see the series of posts starting with Git Introduction.

Push to GitLab

Once you have done some work and you are happy with the work, you can push it up to GitLab. Depending on your workflow, you may also do some unit tests before pushing it up. In the second video at time 17:15 Rghav show us how to use git push. The form of the push up to GitLab is as follows.

git push -u "https://gitlab.com/YourGitLabName/YourProject.git/" master

After running the push command for your project, check that the changes were uploaded by checking GitLab.

Series Navigation<< GitLab Introduction