Menu
×
   ❮     
     ❯   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE

Git GitLab Pages


Host Your Page on GitLab Cloud

With GitLab Cloud, GitLab allows you to host a webpage from your repository. Let's try to use GitLab Cloud to host our repository.


Create a New Repository

Start by signing in to GitLab. GitLab Cloud needs a special name and setup to work, so we start by creating a new blank repository.

This repository needs a special name to function as a GitHub page. It needs to be your GitLab username/workspace ID, followed by .gitlab.io:

GitLab Pages Naming Rules


Push Local Repository to GitLab Cloud

We add this new repository as a remote for our local repository, we are calling it gl-pages (for GitLab Pages).

Copy the URL from here:

GitLab Pages Repository URL

And add it as a new remote:

Example

git remote add gl-pages https://gitlab.com/w3schools-test/w3schools-test.gitlab.io.git

Make sure you are on the master branch, then push the master branch to the new remote:

Example

git push gl-pages master
Enumerating objects: 38, done.
Counting objects: 100% (38/38), done.
Delta compression using up to 16 threads
Compressing objects: 100% (38/38), done.
Writing objects: 100% (38/38), 94.66 KiB | 15.78 MiB/s, done.
Total 38 (delta 21), reused 0 (delta 0), pack-reused 0
To https://gitlab.com/w3schools-test/w3schools-test.gitlab.io.git
 * [new branch]      master -> master

Note: If this is the first time you are connecting to GitLab, you will get some kind of notification to authenticate this connection.


GitLab Site Configuration

GitLab has a lot of different configurations for sites available. But for this we need the configuration for a simple HTML site. Go to GitLab, confirm the files have been uploaded, and click "+" - "New file":

GitLab create new file

Select .gitlab-ci.yml template, with HTML:

GitLab create new config with HTML template

Commmit with a message:

GitLab config commit

It takes a few minutes to set up. But after a little while you can use the repository name as an URL in your broweser to view the result!


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.