Having used both Rstudio and GitHub for a while, but never thought to combine them together. Hadley Wickham already put a detailed instruction on how to link GitHub with Rstudio (http://r-pkgs.had.co.nz/git.html). I just list few quick note from my own experience.
## add your PAT (Personal Access Token, get here: https://github.com/settings/tokens) into your ~/.Renviron file
# echo "GITHUB_PAT=xxxxxxxxxxYOUR-PAT-GO-HERExxxxxxxxxx" >> ~/.Renviron