Git, GitHub & RStudio

RStudio users can leverage git Version control to enhance reproducibility.

The usethis package and the RStudio IDE will help you orchestrate your version control repositories as RStudio projects.


To get started, make a free account. Make sure you have the latest versions of R, RStudio, and usethis. Then, setup your RStudio configuration using two key documents: Setup, and Managing Git(Hub) Credentials.


Clone or fork from GitHub


Create the GitHub repo from local

use_git()          # initialize a git repo
use_github()       # Connect local repo to GitHub

set-up git and manage GitHub credentials

# Sign-in to your GitHub account
# Read:
# Read:
usethis::use_git_config( = "Jane Doe", = "")

Next Level…

Take your reproducibility to the next level. Make your code citable by connecting your GitHub repo and your ORCID (unique author ID) through to the Zenodo archival repository. Now, every time you commit a milestone release, you also mint a DOI.

Containerize your repository with using the holepunch package.

Quick_Publish your code in a container

Use the holepunch package

Bespoke_Publish your code in a binder

I recently found my QuickPublish approach didn’t quite work. So I RTFMed the docs and it seemed to imply a preference for NOT using a .binder/Dockerfile. Therefore, here is an approach that is slightly less automated but more bulletproof.

Step 1

holepunch::write_compendium_description()  # output is a DESCRIPTION file in the project root
holepunch::write_runtime()    # output is .binder/runtime.txt
holepunch::write_install()    # output is .binder/install.R
holepunch::generate_badge()   # output is a badge to be found in the README file(s)

Step 2

  1. Edit the .binder/install.R file using the following model.
  2. Edit the binder/install.R file based on this model or the documentation
  3. Edit the DESCRIPTION file using this basic model. Modify all the fields. You may want to base the Depends and Remotes sections on your .binder/install.R file

The old documentation from this site can be found in the v.0.2019 release on GitHub.


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-NC 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 ...".