Skip to content

Deploy your Astro Site to GitHub Pages

How to deploy your Astro site to the web using GitHub Pages.

You can use GitHub Pages to host a static, prerendered Astro website directly from a repository on GitHub.com using GitHub Actions.

Astro maintains an official Astro GitHub Action to deploy your project to a GitHub Pages with very little configuration and is the recommended way to deploy to GitHub Pages.

Follow the instructions below to use the GitHub Action to deploy your Astro site to GitHub Pages. This will create a website from your repository at a GitHub URL (e.g. https://<username>.github.io/<my-repo>). Once deployed, you can optionally configure a custom domain to deploy your GitHub Pages site at your preferred domain (e.g. https://example.com).

When you push changes to your Astro project’s repository, the GitHub Action will automatically deploy them for you at your GitHub URL.

Once your Astro project is deployed to GitHub pages at a GitHub URL following the previous instructions, you can configure a custom domain. This means that users can visit your site at your custom domain https://example.com instead of https://<username>.github.io.