Here describe how we can host websites on GitHub pages. To do that, we need to install Git and create a GitHub account. Some introduction resources about Git and GitHub are the following:
R projects allows us to keep all files associated with a project together.
Chapter 8.4 RStudio projects: https://r4ds.had.co.nz/workflow-projects.html
To create projects from Git repositories you should install Git and
then restart RStudio.
Note that if Git is installed and not on the path, then you can specify
its location using the Options dialog.
https://support.rstudio.com/hc/en-us/articles/200532077?version=1.4.1103&mode=desktop
Google “installing git for windows”
Enter https://git-scm.com/download/win
Click here to download manually (git 64 bit)
To create an R project, first we make a GitHub repo, and then we create an RStudio project:
https://happygitwithr.com/new-github-first.html#make-a-repo-on-github-1
Click the green New repository
button. Or, if you
are on your own profile page click Repositories
and then
the green New
button.
Enter the repository name and description, public/private and Initialize this repository with a README.
Click the big green button
Create repository
.
Copy the HTTPS clone URL to the clipboard by going to the main
page of the new repository, and clicking Code Clone
button
(it will be something like https://github.com/username/reponame.git).
In RStudio, start a new project with
File > New Project > Version Control > Git
. In the
Repository URL
paste the URL of the new GitHub repo (it
will be something like https://github.com/username/reponame.git).
Click Create project
to create a new directory which
will be a directory on the computer, a Git repository linked to a remote
GitHub repo, and an RStudio project.
By doing this, the remote GitHub repo is added as a remote for the
local repo and the local master
branch is now tracking
master
on GitHub. This means we are set up to push and
pull.
Note that after creating the R Project and adding content, we may need to close the project and reopen it in order to RStudio recognizes the project (as a website, blogdown, etc.) and show the appropriate build tools.
Create the R Markdown document, commit and push
git status
git add .
git commit -am "initial commit"
git push