Custom Deployment Script

R blogdown development random-code-snippets

I don’t want to use Netlify for hosting, so I came up with this simple script to deploy my blog.

Robert M Flight


Use a short bash script to do deployment from your own computer directly to your * domain.


So Yihui recommends using Netlify, or even Travis-CI in the Blogdown book. I wasn’t willing to setup a custom domain yet, and some of my posts involve a lot of personally created packages, etc, that I don’t want to debug installation on Travis. So, I wanted a simple script I could call on my laptop that would copy the /public directory to the repo for my site, and then push the changes.

The Script

Here is the simple script I ended up using:

cd path/to/
#rm -rf *
cp -Rfu path/to/blogdown/public/* .

git add *
git commit -m "update at $commit_time"
git push origin master

cd $org_dir

It changes directories, because to push from a git repo I’m pretty sure you need to be in the directory, so it also makes sure to go back there at the end. It then copies the contents of /public to the repo, adds all the files, and then uses the current time-stamp as the commit message, and finally pushes all the updates.


If you see mistakes or want to suggest changes, please create an issue on the source repository.


Text and figures are licensed under Creative Commons Attribution CC BY 4.0. Source code is available at, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".


For attribution, please cite this work as

Flight (2017, Dec. 27). Deciphering Life: One Bit at a Time: Custom Deployment Script. Retrieved from

BibTeX citation

  author = {Flight, Robert M},
  title = {Deciphering Life: One Bit at a Time: Custom Deployment Script},
  url = {},
  year = {2017}