Source file ⇒ lec37.Rmd

Today

  1. Create a public project repository on Github
  2. Download Git
  3. Configure Git with global commands
  4. Open Rstudio and set the path to Git executable
  5. Create a new project based on a remote Git repository
  6. Project Checkin

I wish to show you how to use GitHub with Rstudio. Today I just want you to set everthing up.

Here is an overview of what we are doing: http://www.molecularecologist.com/2013/11/using-github-with-r-and-rstudio/

1. Create a public project repository on Github

Please create your own GitHub account https://github.com

This will take you to a new page where you will:

  1. Name your repository stat133-spring2016 (or some other name)
  2. Make it public
  3. Select “initialize this repository with a README”
  4. Choose “R” in the pull-down menu to add a .gitignore file.

Your screen should look like this (except arlucas will be replaced by your Github name)

Once you click the “Create repository” button, you should see a page like this:

If you wanted to you could enter the username of your project team members (assuming that they already have a GitHub account). In the upper right-hand corner of your repositories main page, you should see a button labelled “Settings”. Click on the “Settings” button will take you to a page where you can edit various settings for your repository. Choose the “Collaborators” button on the “Settings” page (upper left) and add your neighbor’s username.

2. Download Git

Next: Download and install the platform-specific version of Git (not GitHub), default options work well.

For Windows and Mac: http://git-scm.com/downloads

If you are a PC user you may be asked how you plan to use git command line. Choose the default which is command prompt.

For more info (not necessary for most people):

https://support.rstudio.com/hc/en-us/articles/200532077-Version-Control-with-Git-and-SVN

3. Configure Git with global commands.

our If you are a Mac user open terminal (not your virtual data science toolbox terminal but a regular terminal). If you are a PC user open up the command prompt (type cmd in the search box)

Here you want to enter your GitHub username on the first line and your GitHub email on the second line.

4.Open Rstudio and set the path to Git executable

Here is a detailed resource on version control in Rstudio: https://support.rstudio.com/hc/en-us/articles/200532077?version=0.99.467&mode=desktop

In Rstudio

  1. Go to Global Options (from the Tools menu)

  1. Click Git/SVN

If Git executable shows (none), click Browse and select the git executable installed on your system
On a Mac, this will likely be one of
/usr/bin/git
/usr/local/bin/git
/usr/local/git/bin/git
On Windows, git.exe will likely be somewhere in Program Files
Click OK

  1. Click Enable version control interface for RStudio projects
  2. If necessary, enter the path for your Git or SVN executable where provided. You can also create or add your RSA key for SSH if necessary.

You may need to restart your computer.

5 Creating a new project based on a remote Git repository

In R Studio:

Execute the New Project command (from the Project menu) Choose to create a new project from Version Control

Choose Git Provide the repository URL (and other appropriate options) and then click Create Project

Above I have circled my repository URL

The remote repository will be cloned into the specified directory and RStudio’s version control features will then be available for that directory.