5  GithHub + RStudio

Happy Git and GitHub for the useR is a great resource for connecting Git/GitHub and RStudio.

Markdown Cheatsheet

5.1 Lab Specific Git + RStudio Communication

  1. Generate token
  • Log into https://github.com/
  • Go to https://github.com/settings/tokens
  • Press Generate new token
  • Select Generate New Token (Fine-grained, repo-scoped) from the dropdown menu
  • Create token name
  • No description
  • Select expiration
  • Keep public repositories
  • Don’t add any permissions
  • Click generate token
  1. Copy token to computer (notes, word, password organizer, etc…)

  2. Enter GitHub Token into R

  • Check if the “gitcreds” package is installed
    • at the prompt in the Console type ‘gitcreds()’
      • if an Error is received, please install package
install.packages("gitcreds")
  • Add your token to R
    • in the console at the prompt > run the command below
gitcreds::gitcreds_set()
  • Paste token when prompted

  • To check if this worked run “gitcreds::gitcreds_get()”

  • also make sure you have packages rmarkdown and knitr by searching in packages

Create a New Project in RStudio from an existing project on GitHub

Clone Repository

Create a branch in GitHub

For each GitHub repository you will be working on in the lab that is shared among others, you will need to create your own Branch.

Please create your own branch directly in the repository on the GitHub site

Create Pull Request, for review, on GitHub