Overview

Welcome!

This workshop provides an overview of what “version control” systems are and how they fit into collaborative coding within your team. Specifically, we are focusing here on an introductory approach to version control that focuses on using git via RStudio and GitHub. We are always happy to improve workshop content so please don’t hesitate to post an Issue on our GitHub repository if you see clear areas for improvement!

To maximize the value of this workshop to you, we recommend that you take the following steps before the day of the workshop. Depending on whether you’ve used RStudio and/or GitHub before you may have already completed some or all of these steps but please read through the following materials regardless to ensure that all participants arrive with a common foundation of installed programs. If anything is unclear, feel free to reach out to us; our contact information can be found in the “Content Creators” tab.

Programs to Install

Note for those of you with a dedicated IT team that has sole power to install software on your computer: you will need to contact them before the workshop to install the following programs.

R & RStudio

Install R and its more convenient (in our opinion) user-interface: RStudio.

If you already have R, check that you have at least version 4.0.0 by running the following code:

version$version.string

If your version starts with a 3 (e.g., the above code returns “R version 3…”), please update R to make sure all packages behave as expected.

git

Install git

If you are a Windows user, be sure to follow along with “Option 1” in the instructions linked above! That variant gives some under-the-hood tools we’ll implicitly rely on later.

Accounts to Create / Connect

GitHub

Create a GitHub account using your web browser of choice.

Connect git to your GitHub profile. You may want to review the “shell” (also known as the “terminal” or “command line”) to help with this step.

Create a personal access token (PAT). A token is essentially a more secure password that git requires and you can create one by running the following code in RStudio:

# Install the `usethis` and `gitcreds` packages
#install.packages(c("usethis", "gitcreds"))
library(usethis); library(gitcreds)

# Add your GitHub username and email
usethis::use_git_config(user.name = "Jane Doe",
                        user.email = "jane@example.org")

# Create a token (Note this will open a GitHub browser tab)
# See steps 6-10 in GitHub's tutorial (link below)
usethis::create_github_token()

# Copy your Personal Access Token at the end of the above step!

# Now, give your token to RStudio
# After you run this line you'll follow some prompts in the "Console" tab of RStudio
gitcreds::gitcreds_set()

At the end of the above steps your token should be set! For additional information, see GitHub’s PAT Tutorial or the Happy Git with R PAT Tutorial. If this seems a little intimidating, please keep in mind that your experience with downloading programs and creating web accounts will help with these tasks even if you have more minimal coding experience!

Websites to Visit

Supplemental Material

While not technically necessary to attend the workshop, if you’d like you can see the content that created the workshop website you are viewing by visiting our GitHub repository here.