DEV Community

Aisalkyn Aidarova
Aisalkyn Aidarova

Posted on

LAB 1 β€” GitLab CI + Pages From Scratch

🟒 PART 1 β€” Register GitLab Account

Step 1

Go to:

https://gitlab.com
Enter fullscreen mode Exit fullscreen mode

Click Register

Use:

  • Email
  • Username
  • Password

Verify email.


🟒 PART 2 β€” Create New Project

After login:

Click New project

Choose:

πŸ‘‰ Create blank project

Fill:

  • Project name: gitlab-lab
  • Visibility: Public (easier for Pages)
  • Initialize repository with README (optional)

Click Create project


🟒 PART 3 β€” Connect Mac to GitLab (SSH Setup)

Open Mac Terminal.

Step 1 β€” Generate SSH key

ssh-keygen -t ed25519 -C "your_email"
Enter fullscreen mode Exit fullscreen mode

Press Enter for all prompts.


Step 2 β€” Copy Public Key

cat ~/.ssh/id_ed25519.pub
Enter fullscreen mode Exit fullscreen mode

Copy entire output.


Step 3 β€” Add SSH Key to GitLab

In GitLab:

Top right β†’ Profile β†’ Preferences β†’ SSH Keys

Click Add new key

Paste key β†’ Click Add key


Step 4 β€” Test SSH

ssh -T git@gitlab.com
Enter fullscreen mode Exit fullscreen mode

You should see:

Welcome to GitLab, @yourusername!
Enter fullscreen mode Exit fullscreen mode

🟒 PART 4 β€” Clone Project to Mac

Go to your project page.

Click:

Code β†’ Clone β†’ SSH

Copy URL like:

git@gitlab.com:username/gitlab-lab.git
Enter fullscreen mode Exit fullscreen mode

Now in terminal:

git clone git@gitlab.com:username/gitlab-lab.git
cd gitlab-lab
Enter fullscreen mode Exit fullscreen mode

Check:

ls -la
Enter fullscreen mode Exit fullscreen mode

You should see .git folder.


🟒 PART 5 β€” Create First Website

Create public folder:

mkdir public
Enter fullscreen mode Exit fullscreen mode

Create index file:

cat > public/index.html <<'EOF'
<!DOCTYPE html>
<html>
<head>
  <title>My First GitLab CI Site</title>
</head>
<body>
  <h1>Hello DevOps World πŸš€</h1>
</body>
</html>
EOF
Enter fullscreen mode Exit fullscreen mode

🟒 PART 6 β€” Create GitLab CI File

Create file:

touch .gitlab-ci.yml
Enter fullscreen mode Exit fullscreen mode

Open it:

nano .gitlab-ci.yml
Enter fullscreen mode Exit fullscreen mode

Paste:

image: busybox

pages:
  stage: deploy
  script:
    - echo "Deploying to GitLab Pages"
  artifacts:
    paths:
      - public
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
Enter fullscreen mode Exit fullscreen mode

Save and exit.


🟒 PART 7 β€” Push Code (Trigger Pipeline)

git add .
git commit -m "Setup GitLab Pages site"
git push origin master
Enter fullscreen mode Exit fullscreen mode

(If your branch is main, use main instead.)


🟒 PART 8 β€” Watch First CI Job

Go to:

πŸ‘‰ Build β†’ Pipelines

You will see:

Pipeline running β†’ then green.

Click pipeline β†’ see job logs.

This is your first CI job.


🟒 PART 9 β€” Open Your Website

After pipeline is green:

Go to:

πŸ‘‰ Deploy β†’ Pages

Open URL:

https://username.gitlab.io/gitlab-lab/
Enter fullscreen mode Exit fullscreen mode

You will see:

Hello DevOps World πŸš€
Enter fullscreen mode Exit fullscreen mode

🎯 What You Just Learned

You just completed:

βœ” GitLab registration
βœ” SSH authentication
βœ” Git clone
βœ” Git workflow
βœ” CI pipeline
βœ” Artifacts
βœ” Static deployment

This is real DevOps foundation.


🧠 What DevOps Should Understand

  • .gitlab-ci.yml controls pipeline
  • Branch triggers deployment
  • public/ folder becomes website
  • CI/CD is event-driven (push = pipeline)
  • SSH is secure authentication

Top comments (0)