LAB 1 — GitLab CI + Pages From Scratch

Published: (February 20, 2026 at 06:17 PM EST)
3 min read
Source: Dev.to

Source: Dev.to

PART 1 — Register GitLab Account

  1. Create a GitLab account

    • Go to and click Register.
    • Fill in Email, Username, and Password, then verify your email.
  2. Create a new project

    • After logging in, click New projectCreate blank project.
    • Project name: gitlab-lab
    • Visibility: Public (easier for Pages)
    • (Optional) Check Initialize repository with a README.
    • Click Create project.
  3. Add an SSH key

    # Generate a new SSH key (replace with your email)
    ssh-keygen -t ed25519 -C "your_email"
    # Press Enter for all prompts
    cat ~/.ssh/id_ed25519.pub   # copy the output
    • In GitLab: Top right → Profile → Preferences → SSH KeysAdd new key → paste the key → Add key.
    • Test the connection:
    ssh -T git@gitlab.com
    # Expected output: "Welcome to GitLab, @yourusername!"
  4. Clone the repository

    • On the project page, go to Code → Clone → SSH and copy the URL (e.g., git@gitlab.com:username/gitlab-lab.git).
    git clone git@gitlab.com:username/gitlab-lab.git
    cd gitlab-lab
    ls -la   # you should see a .git folder
  5. Create the site structure

    mkdir public
    cat > public/index.html 
    
    
      My First GitLab CI Site
    
    
      

Hello DevOps World 🚀

EOF


6. **Add a CI configuration**  
```bash
touch .gitlab-ci.yml
nano .gitlab-ci.yml   # paste the following
image: busybox

pages:
  stage: deploy
  script:
    - echo "Deploying to GitLab Pages"
  artifacts:
    paths:
      - public
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  • Save and exit the editor.
  1. Commit and push

    git add .
    git commit -m "Setup GitLab Pages site"
    git push origin master   # use `main` if your default branch is named main
  2. Run the pipeline

    • Navigate to Build → Pipelines in GitLab.
    • The pipeline should start, then turn green once completed.
    • Click the pipeline to view job logs – this is your first CI job.
  3. View the deployed site

    • After the pipeline succeeds, go to Deploy → Pages.
    • Open the provided URL, e.g., https://username.gitlab.io/gitlab-lab/.
    • You should see Hello DevOps World 🚀.

What you’ve accomplished

  • Registered on GitLab and created a project.
  • Set up SSH authentication.
  • Added a simple static site (public/ folder).
  • Configured a CI/CD pipeline with .gitlab-ci.yml.
  • Deployed the site using GitLab Pages.

The pipeline runs automatically on pushes to the default branch, turning your repository into a fully automated deployment workflow.

0 views
Back to Blog

Related posts

Read more »

Warm Introduction

Introduction Hello everyone! I'm fascinated by the deep tech discussions here. It's truly amazing to see the community thrive. Project Overview I'm passionate...