Astro Crash Course #13 - Deploying to Netlify

Net Ninja| 00:05:11|Apr 18, 2026
Chapters6
Creates a new GitHub repo named Astroyen, initializes it, and prepares to push the local project to GitHub.

Link a GitHub repo, push the main branch, and let Netlify deploy your Astro site automatically with a single deploy button.

Summary

Net Ninja wraps up the Astro course by showing a clean path to deployment on Netlify. He starts by creating a new GitHub repo (Astro Book Bites) and pushes the local Astro project’s main branch to that remote using git remote add origin URL and git push origin main. After the code is on GitHub, he signs up for a free Netlify account, links his GitHub, and imports the Astro Book Bites repository. In Netlify, he names the Netlify project “book bytes,” selects the main branch, and confirms that the base directory is the root. He notes that Astro’s build output lands in the dist folder, so there’s no need to tweak the build command or publish directory. With a few clicks, Netlify builds the project and deploys it automatically, showing a “published” status and a green site link. Finally, he demonstrates previewing the deployed site and signs off by hinting at an Astro Masterclass if there’s interest. Net Ninja keeps the tone practical and hands-on, ensuring viewers can reproduce the deployment end-to-end.

Key Takeaways

  • Create a GitHub repository (Astro Book Bites), initialize it, and push your Astro main branch with git remote add origin <URL> and git push origin main.
  • Sign up for Netlify's free plan, connect your GitHub account in Settings, and choose Import from Git to bring in the repository for deployment.
  • In Netlify, name the project (e.g., book bytes), select the main branch, and leave the base directory blank since the repo root is used.
  • Rely on Astro's default build output by noting that Astro places the built site in the dist folder, so no build command or publish directory changes are needed.
  • Click Deploy to initiate Netlify’s import, build, and automatic deployment; the site shows as published with a green link for preview.
  • Once deployed, you can click the site link to preview it live and verify everything works as expected.
  • This approach provides a repeatable, Git-driven deployment workflow suitable for small Astro projects and tutorials.

Who Is This For?

Essential viewing for Astro developers looking to deploy via Netlify using a GitHub-backed workflow, with concrete, repeatable steps and minimal configuration.

Notable Quotes

"And then we'll scroll right down to the bottom and initialize it."
Demonstrates initializing a new GitHub repo for the project.
"So that means when we push this repo up now it's going to push it to the remote we just added."
Explains the effect of adding the remote origin and pushing main.
"Now the first thing you will need to do is sign up for a free account."
Intro to Netlify setup and GitHub integration.
"Then we just want to click on this deploy button at the bottom."
Triggers Netlify to import, build, and deploy the project.
"Netlify is going to import and build the project and then automatically deploy it for us."
States the end-to-end deployment outcome.

Questions This Video Answers

  • How do I deploy an Astro site to Netlify from GitHub?
  • What steps are needed to link a GitHub repo to Netlify for deployment?
  • What is the meaning of Astro's dist folder in the deployment process?
  • Can I deploy multiple Astro projects to Netlify from separate GitHub repos?
  • What should I do if Netlify shows a failed deployment after linking GitHub?
NetlifyGitHubAstroAstro Book Bitesdeploy from Gitbuild dist folderNetlify deployment workflowcontinuous deployment
Full Transcript
All right then, my friends. So, there's one more thing I want to show you in this course, and that is how to deploy your Astro site to Netifi. And the easiest way to do this is to link a Netifi project to a GitHub repository. So, we can just import that repo, build the project, and deploy it. Which means we're going to have to push our project up to GitHub to begin with. So, with that in mind, I'm going to make a brand new repo here on GitHub first of all, which I'll call Astroyen book bytes, but the name doesn't really matter. Then, I'm going to make this repo private. you don't need to. And then we'll scroll right down to the bottom and initialize it. All right. So once that's done, we just need to grab the repo URL so we can push to it from our local project. So at the start of this course, I said that I was going to initialize a git repo for the project. That was one of the options that Astro gave to us initially. And throughout this course, I've been making commits between each lesson. So now all I need to do is link this local repo with the remote repo I just made on GitHub and then push up the main branch. First then we need to add the remote repo using the link we just copied. To do that, open a terminal and just type git remote add. Then we give this a name origin and then we'll paste in the URL we copied and hit enter. So that means when we push this repo up now it's going to push it to the remote we just added. So now I can just type another command which is get push origin which is the remote we just added then main because we want to push up the main branch and that's going to push the main branch up to GitHub then. So if we refresh the repo now we should see that main branch has been pushed up and now we can link this repo to Netifi and ask it to deploy this main branch. So then let's head to Netifi to do this. Now the first thing you will need to do is sign up for a free account. And once you've done that, you're likely to be taken to this dashboard page. It looks something like this. It might change slightly, but I'd also recommend linking your GitHub account if you didn't sign up with it. Uh, which you can do by clicking on your account profile down here. Then just go into your settings. Once you've done that, hit this project link so that we can import a new project from Git by clicking on this button right here. Then we want to deploy from GitHub. So, select that next. And this might open a new browser for you to authorize access to your GitHub account, which you can go ahead and do. After that, we want to select the repo that we want to deploy, which in my case is called Astro Book Bites. So, I'm just going to search for that one right here. When I see it, I'm going to select it. And next up, we need to give the project a name, which I'm going to call book bytes. And below that, we've got a few different options. First of all, the branch that we want to deploy, which I'm going to keep as main. Second, we can specify a base directory of the project on this branch, but we'll leave it blank because it's going to be the root directory for us. Then, we can update the build command and the publish directory if we need to, but we don't need to because this is the correct build command. And Astro puts the built site into a disc folder when it's done. So, we can skip over those. And finally, you can add a functions directory if you have one for Netly Cloud Functions, but we don't, so we can skip that as well. And same for environment variables. We don't have any, but if you did, then you can add them right here. And finally, we just want to click on this deploy button at the bottom. Now, when we do that, Netifi is going to import and build the project and then automatically deploy it for us. So, this is just going to take a minute or so to complete. Once it's finished, you should see down here that it says published. And also up here, the link to the site is green. So, we can click on that to preview the site at this address. And hopefully, fingers crossed, we should see everything working, which by the look of things, we do. Awesome. So then, my friends, that is how to easily deploy your Astro site to Netifi. And that's now pretty much the end of this series as well. So, I really hope you enjoyed it and that you learned a lot along the way. Also, I am considering making a whole Astro Masterass, which would be much, much longer than this one. It's going to go into a lot more detail about different features and we flesh out a more complex site during it. So, if that is something you would like to see, then please let me know in the comments. And if enough people want it, and if this series does well enough, then I'll go ahead and make that. Otherwise, please don't forget to share, subscribe, and like the videos. And I'm going to see you all in the very next one. Heat. Heat. [music]

Get daily recaps from
Net Ninja

AI-powered summaries delivered to your inbox. Save hours every week while staying fully informed.