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.
- First go to gitlab.com
Look for the register button in the top right corner and click it.
- Fill in the registration form and click register or use one of the other registration options such as register with Google.
- Once registered you will be presented with a welcome screen like the following.
- Click the Create a project option. Repositories are created within projects.
- You will be presented with a number of options here. I am going to create a blank project called djangoApp and make it public.
When you are happy with the new project settings click Create project.
- 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.
- 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.
Then in the menu on the left, click on ssh keys.
I am working on an Ubuntu system and have an ssh key already in place.
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.
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 firstname.lastname@example.org
You should see some thing like the following.
- Once your keys are in place you should be able to push code to your new repo.
Go back to your project.
Click into the project you created previously.
You will see various instruction.
First set your global settings
I will follow the instructions to Push an existing folder.
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.
Thats 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.