Skip to content

Latest commit

 

History

History
175 lines (119 loc) · 3.83 KB

File metadata and controls

175 lines (119 loc) · 3.83 KB

🔧 Quick Fix: GitHub Pages Deployment Error

❌ Error yang Terjadi:

Error: Creating Pages deployment failed
Error: HttpError: Not Found
Ensure GitHub Pages has been enabled: 
https://github.com/ITIF-Syuhada/pemrograman-dasar/settings/pages

✅ Solusi (3 Langkah Simple):

Step 1: Enable GitHub Pages

  1. Buka halaman settings:

    https://github.com/ITIF-Syuhada/pemrograman-dasar/settings/pages
    
  2. Klik pada "Source" dropdown

  3. Pilih: "GitHub Actions"

    • ❌ JANGAN pilih "Deploy from a branch"
    • ✅ PILIH "GitHub Actions"
  4. Klik Save


Step 2: Verify Workflow Permissions

  1. Buka Actions settings:

    https://github.com/ITIF-Syuhada/pemrograman-dasar/settings/actions
    
  2. Scroll ke "Workflow permissions"

  3. Pastikan dipilih:

    • Read and write permissions
    • Allow GitHub Actions to create and approve pull requests
  4. Klik Save


Step 3: Re-run GitHub Actions

  1. Buka Actions tab:

    https://github.com/ITIF-Syuhada/pemrograman-dasar/actions
    
  2. Klik workflow yang failed

  3. Klik "Re-run all jobs"

  4. Wait for deployment to complete (~2-3 minutes)


🎉 Success!

Setelah workflow sukses, site akan live di:

https://itif-syuhada.github.io/pemrograman-dasar

📋 Checklist

Pastikan semua sudah ✅:

  • GitHub Pages Source = "GitHub Actions"
  • Workflow permissions = "Read and write"
  • Workflow sudah di-rerun
  • Build step ✅ success (hijau)
  • Deploy step ✅ success (hijau)
  • Site bisa diakses di URL

🔍 Troubleshooting

Jika masih error setelah langkah di atas:

  1. Check Build Logs:

    • Actions → Pilih workflow run → Klik "build" job
    • Cari error message di console
  2. Common Issues:

    • npm ci failed → Check package-lock.json
    • npm run build failed → Test locally dulu
    • ❌ Permission denied → Check repository permissions
  3. Test Local Build:

    npm ci
    npm run build
    npm run preview

    Jika local build sukses, berarti code OK.

🚨 Jika Deployment Berhasil tapi Website 404:

Jika GitHub Actions berhasil tapi https://itif-syuhada.github.io/pemrograman-dasar/ masih 404:

1. Check GitHub Pages Settings:

2. Check Environment:

3. Wait 5-10 Minutes:

  • GitHub Pages butuh waktu untuk propagate
  • Coba akses lagi setelah 10 menit

4. Check Base Path:

Pastikan di dist/index.html ada base path /pemrograman-dasar/:

<script src="/pemrograman-dasar/assets/index-xxx.js"></script>
<link href="/pemrograman-dasar/assets/index-xxx.css" rel="stylesheet">

5. Force Re-deploy:

  • Go to Actions → Pilih workflow → "Re-run all jobs"
  • Atau push commit kosong: git commit --allow-empty -m "force redeploy" && git push

📞 Need Help?

Jika masih ada masalah:

  1. Check workflow file di .github/workflows/deploy.yml
  2. Read error logs di GitHub Actions
  3. Create issue di repository dengan:
    • Screenshot error
    • Link ke failed workflow
    • Langkah yang sudah dicoba

🚀 Alternative: Manual Deployment

Jika GitHub Actions masih bermasalah, bisa deploy manual:

# Install gh-pages
npm install -D gh-pages

# Add script to package.json
"deploy": "npm run build && gh-pages -d dist"

# Deploy!
npm run deploy

Lalu di GitHub Settings → Pages:

  • Source: Deploy from a branch
  • Branch: gh-pages / (root)

Happy deploying! 🎉