π’ PART 1 β Register GitLab Account
Step 1
Go to:
https://gitlab.com
Click Register
Use:
- 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"
Press Enter for all prompts.
Step 2 β Copy Public Key
cat ~/.ssh/id_ed25519.pub
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
You should see:
Welcome to GitLab, @yourusername!
π’ 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
Now in terminal:
git clone git@gitlab.com:username/gitlab-lab.git
cd gitlab-lab
Check:
ls -la
You should see .git folder.
π’ PART 5 β Create First Website
Create public folder:
mkdir public
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
π’ PART 6 β Create GitLab CI File
Create file:
touch .gitlab-ci.yml
Open it:
nano .gitlab-ci.yml
Paste:
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.
π’ PART 7 β Push Code (Trigger Pipeline)
git add .
git commit -m "Setup GitLab Pages site"
git push origin master
(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/
You will see:
Hello DevOps World π
π― 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.ymlcontrols pipeline - Branch triggers deployment
-
public/folder becomes website - CI/CD is event-driven (push = pipeline)
- SSH is secure authentication
Top comments (0)