Master Code
On The Go

Learn. Practice. Build.

How-To Guide

How to Deploy a Website with Netlify

Netlify is the fastest way to get a website online — connect your GitHub repo, and every push auto-deploys in seconds. Here's the complete walkthrough.

🎯 What You'll End Up With

By the end of this guide, your site will be live at a URL anyone can visit:

https://yourproject.netlify.app/
;

Live on Netlify ✅

Deployed in 30 seconds — no server setup required.

🚀 Why Netlify Instead of GitHub Pages?

Both are free. Both work great. But Netlify has some advantages:

Feature GitHub Pages Netlify
Setup time5 min2 min
Auto-deploy on push✅ Yes✅ Yes (faster)
Deploy time1-2 min15-30 sec
Free SSL✅✅
Custom domain✅✅ (easier)
Redirects & headers❌✅ Free
Form handling❌✅ 100 submissions/mo free
Preview deploys (per PR)❌✅ Yes
Rollback deploys❌✅ One-click

💡 My honest take: Use GitHub Pages for personal projects. Use Netlify if you want preview deploys, form handling, or if you're working with a team. Both are excellent.

📋 What You'll Need

1

Sign Up for Netlify

Go to:

👉 app.netlify.com/signup

;

The fastest way is to sign up with your GitHub account:

  1. Click "Sign up with GitHub"
  2. Authorize Netlify to access your repos
  3. You're in — no credit card needed

💡 Sign up with GitHub, always. It saves a step later when you connect a repository for deployment.

2

Deploy Your Site

Netlify gives you two ways to deploy. Pick whichever fits:

Option A: Connect a GitHub repo (recommended)

  1. From your Netlify dashboard, click "Add new site" → "Import an existing project"
  2. Choose GitHub
  3. Pick your repository (e.g., my-website)
  4. Leave the build settings as-is for static HTML (no build command, publish directory = /)
  5. Click "Deploy site"

Every future git push to this repo will trigger an automatic redeploy.

Option B: Drag-and-drop deploy (fastest, no GitHub needed)

  1. Go to app.netlify.com/drop
  2. ;
  3. Drag your entire website folder into the box
  4. Wait 10 seconds — your site is live

To update: drag the folder again. No version control required.

3

Wait for the First Deploy

Netlify shows a live log of what's happening. For a static HTML site, it looks like this:

10:23:01 PM: Build ready to start
10:23:02 PM: Fetching files...
10:23:03 PM: Starting deploy...
10:23:05 PM: Site is live ✅

Total time: 15-30 seconds for a typical site.

✅ Netlify automatically gives you a free SSL certificate. Your site is served over HTTPS from day one.

4

Visit Your Live Site

Netlify assigns you a random subdomain like:

https://sparkly-unicorn-1234.netlify.app

You can rename it to something cleaner:

  1. Go to Site settings → Site details
  2. Click "Change site name"
  3. Enter your preferred name (e.g., my-portfolio)
  4. Save — your new URL is https://my-portfolio.netlify.app

💡 Pick a professional name. my-portfolio.netlify.app looks much better than sparkly-unicorn-1234.netlify.app on a resume.

5

Connect Your Custom Domain

Have a domain? Netlify makes it easy (easier than GitHub Pages).

1. Add the domain in Netlify

  1. Site settings → Domain management
  2. Click "Add custom domain"
  3. Enter your domain (e.g., yourname.com)
  4. Click "Verify" → "Add domain"

2. Two options for DNS

Option A (easiest): Change your registrar's nameservers to Netlify's. Netlify handles all DNS for you. Recommended if you bought the domain specifically for this site.

Option B (keep your DNS): Add these records at your registrar:

# A record for apex (yourdomain.com)
75.2.60.5

# CNAME for www
www → your-site.netlify.app

3. Enable HTTPS

Netlify provisions a free SSL certificate automatically. It may take up to 24 hours if DNS just propagated.

📚 Don't have a domain? Get one free →

6

Set Up Auto-Deploy (If Using GitHub)

This is Netlify's killer feature. Once your repo is connected, every push auto-deploys.

Test it:

  1. Make a small change to index.html in your repo (via GitHub or locally)
  2. Commit and push
  3. Netlify starts a new deploy automatically
  4. 30 seconds later, your live site is updated

✅ Zero manual steps. No FTP, no SSH, no "upload" button. This is the modern deployment workflow.

7

Bonus: Netlify Forms (Free Contact Forms)

Netlify has a built-in form handler that works without any backend. You get 100 free submissions per month.

Add netlify to any HTML form:

<form name="contact" method="POST" data-netlify="true">
  <input type="text" name="name" placeholder="Your name">
  <input type="email" name="email" placeholder="Your email">
  <textarea name="message" placeholder="Message"></textarea>
  <button type="submit">Send</button>
</form>

That's it. Netlify detects the form on deploy and captures submissions in your dashboard.

💡 Compare: GitHub Pages has no form handling. With GitHub Pages you'd need Formspree, EmailJS, or a similar service. Netlify does it for free.

🔧 Common Issues (and Fixes)

❌ Deploy failed: "Build command failed"

You're deploying a static site but Netlify is trying to run a build. Fix:

  1. Site settings → Build & deploy → Build settings
  2. Set "Build command" to blank
  3. Set "Publish directory" to / (or .)
  4. Trigger a new deploy

❌ 404 on all pages except the homepage

Your site is likely a Single Page App (SPA). Add a _redirects file to your repo root with:

/*  /index.html  200

❌ Custom domain shows "Netlify error: DNS not configured"

DNS propagation can take up to 24 hours. Check your records with dnschecker.org. For apex domains, make sure you're using the 75.2.60.5 A record.

❌ HTTPS certificate won't provision

Common causes:

  • DNS hasn't propagated yet — wait 24 hours
  • You have CAA records at your registrar that block Let's Encrypt
  • You have conflicting DNS records (multiple A records for the same hostname)

❌ Form submissions aren't appearing in dashboard

Make sure you have data-netlify="true" on the form AND a unique name attribute. Netlify only detects forms at build time — you must redeploy after adding a form.

❌ Accidentally deleted the wrong deploy

Netlify keeps every deploy. Go to Deploys → find a previous successful deploy → click "Publish deploy" to roll back instantly.

⚖️ Should You Use Both?

Yes — and many developers do. Here's the split I recommend:

💡 Pro tip: Deploy your personal site to both. Point your custom domain to whichever performs better for you. It costs nothing to have both live.

🎯 What's Next?

Your site is live on Netlify. Now what?

← All How-To Guides