Git Using RStudio: Setup

In order to start using version control in Rstudio, we have to do some configuration the first time. You only need to do this configuration once.

Github account

In order to to the tutorial, you’ll need a Github account.

Installations

  1. Download and install Git
  2. Install RStudio

First of all, tell RStudio where to find the Git installation.

  1. Go to Tools > Global Options
  2. Click on Git/SVN.
  3. Check Enable version control interface for RStudio projects
  4. Set the path to the Git executable that you installed
  5. Check use Git bash as shell for Git projects

Git installation path

If you do not know where Git is installed, open your command line (cmd in Start for Windows user). When the cmd is open, type where git and hit enter. The path should be something like: C:/Program Files (x86)/Git/bin/git.exe. Still in trouble? Check this out.

RStudio setup for git

Github configuration

Next, we have to tell Github who we actually are, in order to make the connection to the online account. To do so, Git requires the configuration of your Github (!) username and GitHub email:

  1. Go to Tools > Shell to open the Git Shell

    RStudio setup git shell

  2. In the shell, type the following command and enter:
    git config --global user.name "mygithubusername"
    
  3. Still in the shell, type the following command and enter:
    git config --global user.email "my.name@inbo.be"
    

Github configuration check

Use your GitHub username! You can check if you’re set up correctly by typing in the same shell:

git config --global --list

When successful, the configuration is done. Congratulations!