This guide explains how to deploy your projects from GitHub to Netlify for automated, continuous deployment.
Deploying your project from GitHub to Netlify is like setting up an automated pipeline: once it's linked, every time you push code to GitHub, Netlify automatically updates your live site. It’s one of the smoothest workflows in web development.
- Log in to Netlify: Go to app.netlify.com and sign in. (Pro tip: Sign in using your GitHub account to save time on authorization later).
- Start a New Project: On your team dashboard, click the Add new site button and select Import an existing project.
- Choose Your Provider: Click the GitHub button. A popup will appear asking for permission.
- Note: You can choose to give Netlify access to all your repositories or just selected ones. For better security, picking only the repos you need is a solid move.
- Pick Your Repo: Search for the repository you want to deploy and click on it.
- Basic Settings:
- Branch to deploy: Usually
mainormaster. This is the branch Netlify watches for changes. - Base directory: Leave this blank unless your frontend code is inside a subfolder (like a monorepo).
- Branch to deploy: Usually
- Build Settings: Netlify is pretty smart—it usually auto-detects your framework (React, Vue, Vite, etc.).
- Build command: Usually something like
npm run buildoryarn build. - Publish directory: This is where your compiled files live. For Vite it's
dist, for React it'sbuild, and for Next.js it’s usually.next.
- Build command: Usually something like
- Click "Deploy [Project Name]": Netlify will start the build process. You can click on the "Production deploys" log to watch the "cooking" in real-time.
- Claim Your URL: Once the status turns to Published, you’ll see a randomly generated URL (like
sparkly-unicorn-12345.netlify.app). - Change the Name: Don't like the random name? Go to Site configuration > Site details > Change site name to give it a custom sub-domain.
- Environment Variables: If your code uses API keys (like
.envfiles), go to Site configuration > Environment variables and add them there. Netlify won't see your local.envfile because it's (hopefully!) ignored by Git. - Continuous Deployment: From now on, you don't need to touch Netlify. Just
git pushto yourmainbranch, and your site will update automatically in about 30–60 seconds.
Based on content from IRLMEDIA