Home Projects Blog About Contact
Download CV
Back to Blog

Deploying to Netlify from GitHub: A Complete Guide

Step-by-step guide to deploying your web projects to Netlify directly from GitHub with automatic deploys, custom domains, and environment variables.

Deploying to Netlify from GitHub: A Complete Guide

Deploying websites has never been easier. Netlify offers a seamless experience for hosting static sites and modern web applications directly from your GitHub repository.

Why Netlify?

Netlify stands out for several reasons:

  • Zero-config deploys — push to GitHub, Netlify builds and deploys
  • Free SSL certificates — HTTPS out of the box
  • Global CDN — your site is fast everywhere
  • Preview deploys — every pull request gets its own URL
  • Serverless functions — add backend logic without a server

Setting Up Your First Deploy

1. Connect Your Repository

Head to app.netlify.com and click “Add new site”. Select your GitHub repository.

2. Configure Build Settings

For a typical Astro project:

Build command: npm run build
Publish directory: dist

For a plain HTML/CSS/JS project:

Build command: (leave empty)
Publish directory: . (or your folder)

3. Deploy

Click “Deploy site” — that’s it. Netlify will:

  1. Clone your repository
  2. Install dependencies
  3. Run your build command
  4. Deploy the output to their CDN

Custom Domain Setup

After your first deploy, you can add a custom domain:

Site settings → Domain management → Add custom domain

Netlify will automatically provision an SSL certificate via Let’s Encrypt. DNS propagation usually takes a few minutes.

Environment Variables

For projects that need API keys or secrets:

Site settings → Environment variables → Add a variable

Access them in your code:

const apiKey = process.env.MY_API_KEY;

Pro tip: Never commit API keys to your repository. Always use environment variables for sensitive data.

Automatic Deploy Previews

One of Netlify’s best features — every pull request gets a unique preview URL:

https://deploy-preview-42--your-site.netlify.app

This makes code reviews much easier because reviewers can see the live result before merging.

My Projects on Netlify

I recently deployed two projects:

Both deploy automatically from GitHub on every push to the main branch.

Conclusion

Netlify has become my go-to platform for deploying frontend projects. The GitHub integration is seamless, the free tier is generous, and the developer experience is excellent.

If you’re still deploying manually via FTP or managing your own server for static sites — give Netlify a try. You won’t go back.