3 Hari GitHub · 2 menit baca · 0 tayangan

Hari 2: Clone, Push & gitignore

Mengkloning repo, mendorong perubahan, dan melindungi file sensitif dengan .gitignore.

Created 2026-09-25Updated 2026-09-16#github#git#tools

Pengantar

Dari Hari 1 repo sudah ada. Hari ini: alur kerja harian + .gitignore.

Clone

Di folder induk proyek:

git clone git@github.com:USERNAME/latihan-github.git
cd latihan-github
ls
git remote -v

Edit → commit → push

echo "Belajar GitHub" >> README.md
git add README.md
git commit -m "docs: update README"
git push

Lihat di GitHub: commit baru muncul.

Pull sebelum push (kebiasaan baik)

git pull
git push

Mengurangi risiko ditolak karena remote lebih maju.

.gitignore

File yang tidak boleh masuk repo:

  • rahasia (.env, kunci API)
  • dependensi (node_modules/)
  • build (dist/, .next/)
  • OS sampah (.DS_Store)

Contoh .gitignore untuk proyek Node/Next sederhana:

node_modules/
.next/
dist/
.env
.env.*
!.env.example
.DS_Store
*.log
touch .gitignore
# edit isinya
git add .gitignore
git commit -m "chore: tambah gitignore"
git push

README yang membantu

README minimal:

  • Nama proyek
  • Cara menjalankan
  • Stack singkat

GitHub merender README.md di beranda repo.

Kuis hari 2

File mana yang paling layak masuk .gitignore?

git clone berguna untuk?

Checklist

0/4 selesai

Komentar

0 komentar

Masuk untuk menulis komentar. Masuk

Belum ada komentar. Jadilah yang pertama.