Introduction to GitLab for developers

Photo by Erik Mclean on Unsplash

Why we use GitLab

  • GitLab allows us to locate a repository inside our organization server and to connect to it via our intranet using the free plan.
  • GitLab is less expensive for private repositories (unlimited number of private repositories).
  • GitLab strongly supports the CI/CD lifecycle with more flexibility.

Getting started on GitLab

git clone http://gitlaburl/gitlab/username/my-first-project-on-gitlab.git
$ git clone http://gitlaburl/gitlab/username/my-first-project-on-gitlab.gitCloning into ‘my-first-project-on-gitlab’…
Username for ‘http://gitlaburl': *****
Password for ‘http://gitlaburl': *****
warning: You appear to have cloned an empty repository.

Add SSH key

$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\yourName/.ssh/id_rsa):
Created directory ‘C:\Users\aicha.yourName/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\aicha.fatrah/.ssh/id_rsa.
Your public key has been saved in C:\Users\yourName/.ssh/id_rsa.pub.
$ git clone git@gitlab****/my-first-project-on-gitlab.git
Cloning into 'my-first-project-on-gitlab'...
The authenticity of host 'gitlab.*****' can't be established.
ECDSA key fingerprint is SHA256:**********.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitlab.*****' (ECDSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/home/aicha/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/home/aicha/.ssh/id_rsa": bad permissions
git@gitlab******: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
$ sudo chmod 400 id_rsa
$ git clone git@gitlab.****:****/my-first-project-on-gitlab.git

Repository configuration

  • prevent their creation, if not already created, from everybody except Maintainers
  • prevent pushes from everybody except Maintainers
  • prevent anyone from force pushing to the branch
  • prevent anyone from deleting the branch
  • Maintainer: accepts merge requests on several GitLab projects.
  • Reviewer: performs code reviews on MR (merge requests).
  • Developer: has access to GitLab internal infrastructure & issues (e.g. HR-related).
  • Contributor: Can make contributions to all GitLab public projects

Merge requests and code review

$ git checkout -b feature/ui develop
$ git add index.html
$ git commit -m "feat : first ui"
$ git push origin feature/ui

References:

--

--

--

Software Engineer | Technical Writer | IT Enthusiast

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Python3: Mutable, Immutable… everything is object!

Setting up your company to release apps on the Google Play Store

Adding Audio To Your Cutscenes In Unity

Korean Tokenization & Lemmatization

Publish Your First Python Package on PyPI

Whispered Micro Soft Business Office 365 Keys

Understand Regular Expressions in Python

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aicha Fatrah

Aicha Fatrah

Software Engineer | Technical Writer | IT Enthusiast

More from Medium

Brief knowledge of Docker

An Introduction to Docker Container Technology -1

Backup Elasticsearch cluster to minio S3 server (Part 2)

SAP Monitoring using AWS Data Provider for SAP