User Tools

Site Tools




Hosting a static web page on GitLab

Page Disambiguation

GitLab offers a way to create and host web pages called GitLab Pages. The following article describes how to create a GitLab Pages project.
After creating, you can access your website via https://<user><project>/. Your link looks something like this:
The official documentation can be found here:

It is assumed that the reader has an active Enterprise Lab account and is somewhat familiar with GitLab and Bash.

:NOTE: Server-side languages like PHP or nodeJS will not work with GitLab Pages.

New Project or Migration from

This is the way to go when you are starting from scratch or if you already have a web page running under and would like to migrate.

The easiest way is to create a new project under New project.
Then click on the Create from template tab and select Pages/Plain HTML. button
Finally, click on Use template and give the project a name.
More information about each template can be found with the button Preview.

If you're migrating from, simply remove the contents of the public directory and replace them with the files from your public_html directory.
An elegant way to do this would be the following:

  • connect to an Enterprise Lab ressource like testbed05.el.eee.intern over ssh.
  • clone your new GitLab Pages project
    git clone
  • remove the default content.
    rm ~/your-project/public/*
  • copy your existing web page from public_html to the now empty public folder.
    cp ~/public_html/* ~/your-project/public/
  • commit your changes.
    cd ~/your-project
    git commit -a -m "migrated contents from"
  • push your changes to GitLab.
    git push

Existing project

If you already have an existing GitLab project and want to start using Pages with it, follow these instructions.
:NOTE: Should your project already contain a .gitlab-ci.yml it is necessary to merge the two. Read up on the documentation if you are unsure of how to do this.

1. Add the file .gitlab-ci.yml in the project root directory. This yml content comes from pages/Plain HTML project.
More about .gitlab-ci.yml can be found here:

image: alpine:latest
  stage: deploy
  - echo 'Nothing to do...'
    - public/
  - master

2. Add your index.html file in the subdirectory public.
For an example html file see below.

<p>Hello World!</p>
public/help/gitlab_pages.txt · Last modified: 2019-07-09T14:26+0200 by cvu