Step 5: Deploy to w201rdada.github.io
The web preview is being hosted locally for your eyes only. That’s the place to get your draft finalized, do your debugging, and all around polish off your work. When you’re ready to show it to the world (well your classmates at least), then it’s time to use the _deploy.sh
script.
Go ahead and open the script. This is the list of commands that need to run to deploy the HTML so it will render using the GitHub Pages service. To push to your repository replace these lines:
# git config --global user.email "calnet@berkeley.edu" # git config --global user.name "Oski Bear"
With your own information, being sure to delete the comments at the start of the line. So for me I would replace the lines with:
git config --global user.email "notmyreal@email.edu" git config --global user.name "Brooks Ambrose"
The email is what GitHub will use to identify you with your account, and prompt you for authorization. After you put in your own information, save the file.
Confusingly, your
user.name
is not yourusername
. Put your real human name here rather than your GitHub login. It can be easy to forget thatgit
is a lot older thanGitHub
!The
_deploy.sh
script is meant to be used immediately after the_build.sh
script, so run that first if you haven’t already. Running_build.sh
multiple times won’t cause any problems, other than making you wait, so always press it to be sure you’ve actually built your latest changes before deploying them.The preview build will be located in the
_book
directory, while the deployment build will be in thedocs
directory. This means you can keep working without interfering with a previously published draft. Running the_deploy.sh
script however will overwrite thedocs
build with the_book
build, so it’s a one-way process! Ultimately it doesn’t really matter if something bad happens to the HTML, because if your source is intact you can easily rebuild it.OK enough beating around the bush! RStudio will show the same Run Script button at the top of the
_deploy.sh
script. Go ahead and run the script, and you’ll get some instructions about what to do next:Ready to push with authorization. In Rstudio use menu "Tools > Shell..." and enter: git push origin master Or from an open Rstudio project use menu "Git > Push Branch" or use tab "Git > Push".
You may see an error referring
rpostback-askpass
when receiving a command line prompt for authentication. This can be safely ignored.
You’re ready for Step 6: Activate GitHub Pages!