

First, make sure you have committed all changes to your current working branch with git status. If you do not already have a gh-pages branch, you can create one as follows. For example, if you already have a gh-pages branch: You can modify these options in Settings : Pages for your repository.

Source Branchīefore attempting to publish you should ensure that the Source branch for your repository is gh-pages and that the site directory is set to the repository root ( /). Before attempting to use quarto publish (either locally or from a GitHub Action) you should be sure to configure the Source Branch and Ignore Output as described below. The quarto publish command is an easy way to publish locally rendered documents and websites. Your site will also be updated whenever you commit and push to main. Once you’ve made this configuration change GitHub will trigger a deployment of your website. For example:įinally, configure your GitHub repository to publish from the docs directory of your main branch: To get started, change your project configuration to use docs as the output-dir. If you prefer not to check rendered output into version control see the discussion of using Publish Command below. The simplest way to publish using GitHub Pages is to render to the docs directory and then check that directory into your repository. You can optionally configure a custom domain for a GitHub Pages site, but before exploring that ground you should get your site up and running with the default domain. The URL of the published website will be derived from the combination of your username and the repository name (e.g. We’ll cover each of these methods below, but first an important pre-requisite: you need to have a Git repository on your local machine that is synced to GitHub.
#Set up github pages code
Use a GitHub Action to automatically render your files (a single Quarto document or a Quarto project) and publish the resulting content whenever you push a source code change to your repository. Use the quarto publish command to publish content rendered on your local machine. Render sites on your local machine to the docs directory, check the rendered site into GitHub, and then configure your GitHub repo to publish from the docs directory. There are three ways to publish Quarto websites and documents to GitHub Pages: GitHub Pages is a website hosting service that enables you to publish content based on source code managed within a GitHub repository.
