class: center, middle, inverse, title-slide # Git R Done ## Version control with Git, GitHub and RStudio ### N. Paterno ### PLU --- class: main # Git R Done ### Downloading Git <img src="images/00_git_install.PNG" width="80%" style="display: block; margin: auto;" /> --- class: main # Git R Done ### GitHub::home <img src="images/01_github_home.PNG" width="80%" style="display: block; margin: auto;" /> --- class: main # Git R Done ### GitHub::signup <img src="images/02_github_signup.PNG" width="80%" style="display: block; margin: auto;" /> --- class: main # Git R Done ### Getting ready to sync To sync RStudio and GitHub we'll need to install the `devtools` and `usethis` packages. Run the code below in your console pane in RStudio. ```r install.packages(c("devtools", "usethis")) ``` --- class: main # Git R Done ### Telling your machine your GitHub identity This code will be run in either Terminal (Mac/Linux) or the Command Line (Windows) ```r git config --global user.name "your_github_username" git config --global user.email "email_for_github_login" git config --list ``` The last of these will confirm the other commands ran correctly. --- class: main # Git R Done ### Giving RStudio access to your GitHub Now we need to create a Personal Access Token (PAT) for RStudio to have access to your GitHub account. In your console pane: ```r usethis::create_github_token() ``` -- <img src="images/03_github_PAT.PNG" width="70%" style="display: block; margin: auto;" /> Copy the token! --- class: main # Git R Done ### Giving RStudio access to your GitHub Back to the RStudio console: ```r gitcreds::gitcreds_set() ``` Paste then token when prompted. -- To confirm this worked: ```reval gh::gh_whoami() ``` --- class: main # Git R Done ### Create a new repository <div class="clearfix"> <div class="img-container"> <img src="images/04_github_new-repo.PNG" style="width:100%"> </div> </div> --- class: main # Git R Done ### Create a new repository <div class="clearfix"> <div class="img-container"> <img src="images/04_github_new-repo.PNG" style="width:100%"> </div> <div class="img-container"> <img src="images/05_github_create-new-repo.PNG" style="width:175%"> </div> </div> --- class: main # Git R Done ### Creating an RStudio project <div class="clearfix"> <div class="img-container"> <img src="images/06_rstudio_new-project.PNG" style="width:100%"> </div> </div> --- class: main # Git R Done ### Creating an RStudio project <div class="clearfix"> <div class="img-container"> <img src="images/06_rstudio_new-project.PNG" style="width:100%"> </div> <div class="img-container"> <img src="images/07_rstudio_version-control.PNG" style="width:100%"> </div> </div> --- class: main # Git R Done ### Creating an RStudio project <div class="clearfix"> <div class="img-container"> <img src="images/06_rstudio_new-project.PNG" style="width:100%"> </div> <div class="img-container"> <img src="images/07_rstudio_version-control.PNG" style="width:100%"> </div> <div class="img-container"> <img src="images/08_rstudio_git-clone.PNG" style="width:100%"> </div> </div> --- class: main # Git R Done <img src="images/git_out.jpg" width="70%" style="display: block; margin: auto;" /> --- class: main # Git R Done ### Git commit <img src="images/09_git-commit.PNG" width="70%" style="display: block; margin: auto;" /> --- class: main # Git R Done ### Git commit <img src="images/10_git-commit-message.PNG" width="70%" style="display: block; margin: auto;" /> --- class: main # Git R Done ### Git commit <img src="images/11_git-commit-changes.PNG" width="70%" style="display: block; margin: auto;" /> --- class: main # Git R Done ### Git push <img src="images/12_git-push.PNG" width="70%" style="display: block; margin: auto;" />