Git & GitLab Onboarding: Working Safely on TechLit Computers
Your user home resets on logout. Use the persistent storage area at
/srv/public/ for your keys and projects.
Set up your GitLab account
Section titled “Set up your GitLab account”This phase takes about 10 minutes. You set up your GitLab account, add a persistent SSH key, and set your Git identity.
You need a GitLab account to identify your contributions.
-
Register. Go to GitLab.com and create a free account.
-
Join the group. Once your account is ready, request GitLab write access on WhatsApp. Provide your GitLab username. You will be added to the techlit-africa workspace.
Create a persistent SSH key
Section titled “Create a persistent SSH key”To connect to GitLab without a password, we generate an SSH key. We store it in your persistent folder so it survives a logout.
Set your Git identity
Section titled “Set your Git identity”Git needs to know who is making changes so that your name appears correctly in the project history.
Make a backup before you experiment
Section titled “Make a backup before you experiment”This phase takes about 15 minutes. You make a backup, check status, clone, and save work.
Before practicing Git commands, always make a local duplicate of your folder. This is your 100% safe “undo button” if a command gets confusing.
Check status before every save
Section titled “Check status before every save”Think of git status as the terminal user’s eyes. Run it before you add a file,
after you stage it, and right before you commit. If you ever feel lost, git status is the first command you should type.
Clone the repository
Section titled “Clone the repository”Pull the websites repository from GitLab into your persistent projects
folder.
Save your work in three stages
Section titled “Save your work in three stages”Git uses a holding zone to help you organize what you save.
- Modified: You have edited a file (e.g.,
src/main.js) but haven’t told Git to save it yet. - Staged (
git add): You have picked which changes you want to include in your next save. Think of this as putting files into a “to-be-saved” box. - Committed (
git commit): You have permanently saved the snapshot of your staged files to your local history.
Create a feature branch
Section titled “Create a feature branch”We never edit the main branch directly. We use feature branches to keep our
production code stable. This phase takes about 15 minutes. You create a feature
branch, keep it current, push it, and open a Merge Request.
Keep your branch current
Section titled “Keep your branch current”If you haven’t worked on your feature branch for a few days, rebase it to include the latest team changes.
Push your branch and open a Merge Request
Section titled “Push your branch and open a Merge Request”Once you have committed your work locally, send it to GitLab to share it with the team.
Branch and merge flow
Section titled “Branch and merge flow”flowchart TD
LM["Local main"] --> FB["feature/add_new_feature"]
FB -->|"git push origin"| RM["origin/main"]
RM -->|"Open Merge Request"| MR["Merge Request"]
MR -->|"Merge into main"| RM
RM -->|"git pull"| LM
The feature branch starts from local main and merges back through a Merge Request.
gitGraph
commit id: "start"
commit id: "clone"
branch feature/AddGuide
commit id: "edit"
commit id: "test"
checkout main
merge feature/AddGuide
The diagram shows the commit order on main and the feature branch.
Recover from a mistake
Section titled “Recover from a mistake”- If a rebase or merge becomes confusing, run
git rebase --abort. - Always check your
.gitignoreto ensure temporary files are not tracked. - Anything left in
~/or/home/guestdisappears forever on logout. Always verify your path withpwd.
Run git rebase --abort if a rebase or merge feels wrong. Check your path with
pwd.