To deploy a Quarto website to GitHub using the usethis
package in RStudio on Ubuntu 20.04, follow these steps:
-
Install Required Packages: Ensure you have the
usethis
,quarto
, andgitcreds
packages installed. You can install them using the following commands in RStudio:install.packages("usethis") install.packages("quarto") install.packages("gitcreds")
-
Create a New Quarto Project: Create a new Quarto project in RStudio. You can do this by navigating to
File
>New Project
>New Directory
>Quarto Website
. -
Set git username and password (token) if you first use git:
usethis::use_git_config(user.name = "Your Name", user.email = "your.email@example.com")
-
Set git token (password), you have to get the token from github.com before use:
gitcreds::gitcreds_set()
-
Configure Quarto for GitHub Pages: Modify your
_quarto.yml
file to specify the output directory asdocs
:project: type: website output-dir: docs
-
Build the website files:
system("quarto render")
-
Initialize Git: Initialize a Git repository in your project directory:
usethis::use_git()
-
Create a GitHub Repository: Use
usethis
to create a GitHub repository and link it to your local project:usethis::use_github()
-
Configure GitHub Pages: Go to your GitHub repository settings and configure GitHub Pages to publish from the
docs
directory of themain
branch.