Overview

Overview

Using git and the Gitlab pages provide the following advantages:

  • Automatic build of the website whenever a change of the source code is submitted
  • Static website is hosted for free
  • Source code is saved on remote server (backup)

To achieve this continuous delivery, two tools are now mandatory:

  1. Git: the savier, a source control that manages changes to your repository (= your source files = your content). Changes can be compared between version.
  2. Gitlab: the robot Gitlab is software/service that saves git repositories. It can moreover be used for continuous deployment by automatically rebuilding and updating my website whenever I modify some content.

The interaction between all these tools and services are described by this diagram

graph LR A[fa:fa-laptop git push
send source code] -->B(fab:fa-gitlab GitLab server
Store. Launch script) B --> C[hugo
Build website] C -->|Error| D(fa:fa-times-circle No change) C -->|Success| E(fa:fa-check-circle Website updated)

This can be translated as follows.

I’m working locally on my computer, making change to the content of my website. Whenever I’m happy with these changes, I launch the git push commands that send them to the Gitlab server (like a huge copy/paste). Gitlab then executes the hugo commands to re-build the website. If the process has been validated then the website is updated (erasing the previous version). Otherwise, the website is not changed (still accessible!) and I receive a notification email: I then have to debug.

This whole process takes about 3 to 4 minutes to complete and I only had to send my changes to the Gitlab server.

A short description of each of these tools is provided below.

Preparing your computer

Git

git is probably already installed on your unix system (MacOs and Linux) but you can check by typing git in a shell:

git

For windows user, you might need to install it. Tortoise Git provides a nice graphical interface and is embedded in the folder explorer.

Git Server

For french math scientists, instead of using Gitlab.com, you should create an account on PLMLab, which is an up to date instance of Gitlab, managed by the great PLM team.

Your (professional) website will have a (professional) url: your_account.pages.math.cnrs.fr.

This tutorial focuses on the open-source software Gitlab but everything works quite the same for Github. You can have a look at the academic theme documentation that propose to combine Github with Netlify.

You just have to create an account on your Gitlab’s instance of your choice:

  • Gitlab.com: create a account.
  • PLMlab: reserved for math french academic employees
Gitlab is both a service (gitlab.com) and an open-source software (Gitlab). When speaking about Gitlab, I mean any instance of it: Gitlab.com or PLMlab.math.cnrs.fr for example.
Suivant