Toolstools / github
GitHub
Apa ini
GitHub simpan code online.
Ia bantu simpan versions, collaborate, review changes, dan connect project ke deployment tools seperti Vercel.
Kenapa penting
Tanpa GitHub, project terperangkap dekat satu computer.
Dengan GitHub, kerja boleh backup, review, share dengan tutor, dan deploy.
Apa nak buat
Core idea
Flow
local folder -> git commit -> GitHub repository -> Vercel deployGit menjejak project dalam komputer pelajar. GitHub simpan salinan online.
Create account
- Pergi ke github.com.
- Create account atau sign in.
- Verify email.
- Guna username yang professional enough untuk share.
- Turn on two-factor authentication bila GitHub minta.
Create repository
- Click New repository dalam GitHub.
- Guna nama simple lowercase macam
cafe-website. - Pilih Public untuk class demo atau Private untuk personal work.
- Jangan add README kalau nak push existing local project.
- Click Create repository.
Visual checkpoint:
Reference
Repository page
Owner/name: betul
Visibility: public atau private
Code tab: empty atau files nampak
Green Code button: visiblePush existing project
Run dalam project folder:
Terminal command
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/USERNAME/REPO-NAME.git
git push -u origin mainKalau Git cakap remote already exists:
Terminal command
git remote -vKalau URL salah:
Terminal command
git remote set-url origin https://github.com/USERNAME/REPO-NAME.gitCore features
| Feature | Maksud | Beginner action |
|---|---|---|
| Repository | Online project folder | Satu project = satu repo. |
| Commit | Saved checkpoint | Commit selepas working change. |
| Branch | Separate version path | Stay dekat main untuk Vibe 101. |
| Remote | Connection ke GitHub | Biasanya nama origin. |
| Pull request | Review workflow | Belajar later, tak perlu untuk first deploy. |
| README | Explanation project | Add simple summary selepas first push. |
.gitignore | Files yang Git skip | Jangan push node_modules atau .env.local. |
Secret safety
Jangan commit:
.env.env.local- API keys
- database passwords
- private tokens
Check sebelum push:
Terminal command
git statusKalau .env.local muncul, stop dan fix .gitignore.
Mistake biasa
- Upload dependency folders.
- Guna repository name yang unclear.
- Lupa commit sebelum push.
- Create GitHub repo dengan README, then kena merge conflict.
- Push secrets.
- Deploy sebelum code terkini dipush.
Next step
Pergi ke Vercel.