Skip to content

Git

Git is the de facto version control system.
It keeps track of changes, including adding and removing files and multiple changes to the same file. It conveniently allows to see the differences in time to any particular file, and allows to rollback in time.
It also has many advanced features which allow to coordinate changes to multiple files across different repositories, made by different people, and also have multiple timelines (branches), but we won’t be needing that at FabAcademy.

The Setup

One has to have local SSH key, which can be used by git to authenticate itself with the server and do the basic communications .
If one does not already have a key the recommendation is to generate one with

ssh-keygen -t ed25519 -C "your_email@example.com"

And add the generated key to GitLab on User Settings -> SSH keys

Once that’s done, one can clone (copy locally) the remote repository with

git clone git@gitlab.fabcloud.org:academany/fabacademy/2026/labs/your_lab/students/your_name.git

This info can be seen if you click the “Code” dropdown and select “clone with SSH”

The basics

This works in 3 steps.

Step 0 (optional): check the current state to see which files were changed or need to be added

git status

Step 1: Selecting which files to add

git add myfile.md

We can also add everything in the current dir:

git add .

Step 2: Committing the group of changes:

git commit -m "description of the change I did"

If we skip the message, git will open your configured editor and ask for one

Step 3: Push the changes

git push

This will send the your local changes to a remote repository, so that your work is backed up and can be seen by other people

Slightly more advanced

Due to supply chain attacks, it is increasingly important to be mindful of security.
I wanted to do something that I hadn’t done before, which is to digitally sign my commits.
Luckily git and GitLab provide a convenient way to do so, which is to to use the same key that is used to upload to GitLab, to sign the commits.
I already had a ssh key configured (id_rsa.pub), so I just had to issue the following commands:

echo "$(git config user.email) $(cat ~/.ssh/id_rsa.pub)" >> ~/.ssh/allowed_signers

git config --global commit.gpgsign true

git config --global gpg.ssh.allowedSignersFile ~/.ssh/allowed_signers

If everything went OK, one can commit and check the signature with

git log --show-signature -1