Learning Goals

  1. Install Git, GitHub Desktop, Box Drive, Box Tools, R, R Studio
  2. Get access to the WWS GitHub
  3. Connect R with Git

Step 1: R and R Studio

R has some great tools that help make using Git easier. It’s also a great tool for reproducible analysis.

RStudio provides a user friendly interface to using R.

  1. Download R: https://cran.rstudio.com/

  2. Run the R installer – Keep all default settings.

  3. Download RStudio: https://posit.co/download/rstudio-desktop/

  4. Run the RStudio installer – Keep all default settings.

  5. Check installation

    • Open RStudio

    • Type the following in the console: print("hello world")

    • Hit enter


Step 2: Git

What is Git and why use it?

Git is a tool that helps you:

  • Keep backups – If your computer is lost or damaged, you can get your files back from GitHub.

  • Track changes – See what you changed, when, and why. No more saving 10 versions of the same file.

  • Collaborate – Work with others without overwriting each other’s work.

Recommended video
Alice Bartlett explains Git for beginners:
Slides from her talk

Install Git

  1. Download Git for Windows: gitforwindows.org

    • If you’re using a different operating system check out this resource on how to set up Git.
  2. Run the installer – Keep all default settings.

  3. Check it worked:

    • In RStudo, go to the terminal tab

    • Type: git --version

    • If you see a version number, you’re good. If not, try again or ask for help.


Create a GitHub Account

  1. If needed sign up for a (free) GitHub account (https://github.com/).
  2. Ensure you have access to the WWS GitHub
  3. If you don’t have access, send your email to
  4. Check your email to accept the invite to the organization

Tell Git Who You Are

Run these commands in RStudio (replace with your name and the email you used for GitHub):

#install.package("usethis") #only run once to install package
library(usethis)

usethis::use_git_config(user.name = "Your Name Here",
                user.email= "Your Email Here")

Step 3: Connect RStudio to GitHub

Now we’ll link your GitHub account to RStudio. To do this you need to get an access token from GitHub. This is a long string of characters (basically a password) that connects RStudio to GitHub.

  1. Check if you already have one:

    #install.packages(gitcreds) #run the first time 
    library(gitcreds)
    gitcreds::gitcreds_get()
    ## <gitcreds>
    ##   protocol: https
    ##   host    : github.com
    ##   username: katiewampler
    ##   password: <-- hidden -->

    If your GitHub username shows up, you can skip ahead. If not:

  2. Create a new token:

    #install.packages(gitcreds) #run the first time 
    library(gitcreds)
    
    usethis::create_github_token()

    This will open GitHub in your browser — scroll down, click Generate token (green button), and copy it.

  3. Store your token:

    This is important as once your token is generated you can’t get it from GitHub again.

    gitcreds::gitcreds_set() 

    When prompted for a password, paste your token. Done!

  4. Ensure it worked

    Once you’ve got your token, you can run the following lines in R to check that your credentials are stored correctly:

    gitcreds::gitcreds_get()}

Step 5: Install Box Drive

  1. Go here and install Box Drive and Box Tools

Step 6: Check Documents Folder Location

At OSU, the default is not the C Drive, which can create issues with file paths in R. We’ll go into more detail later, but we want to make sure you have a good folder to save your project to.

  1. Navigate to: This PC → Windows (C:) → Users → your username → Documents

  2. If you don’t see the Documents folder, go to your Documents folder in the Quick Access bar and copy it to C:/Users/yourusername/


You’re All Set!

Now you can:

  • Save versions of your work without making endless copies

  • Restore old versions

  • Share work with others safely

  • Keep a backup online in case disaster strikes


More Resources