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:
- Git: the savier, a source control that manages changes to your repository (= your source files = your content). Changes can be compared between version.
- 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
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 pushcommands that send them to the Gitlab server (like a huge copy/paste). Gitlab then executes the
hugocommands 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 minuts 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 is probably already installed on your unix system (MacOs and Linux) but you can check by typing
git in a shell:
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: