Installing and configuring R and RStudio to work with Github

Installing RStudio software dependencies on Windows

If you are working on a Windows computer, R provides a convenient way to install software from the Console window in RStudio so that we don’t have to navigate to different websites. Follow the instructions written below.

Install the “installr” package

This only needs to be done once per computer. The installr package will handle all our downloading and installation needs. Run the following in your Console window:


Load the “installr” package

To use the installr package, type in the Console window:


You only need to do this once per RStudio session. Note that it’s not an error if you get the following output:

Loading required package: stringr

Welcome to installr version 0.19.0

More information is available on the installr project website:

Contact: <>
Suggestions and bug-reports can be submitted at:

            To suppress this message use:

If you close RStudio, then you will need to run this again before proceeding.

Install Git

To interface with Github, we need to install Git. To install Git on your computer, run the following:


It will download Git and run the installer. Choose all the default options during the installer. Be sure to choose the open to install “OpenSSL”. Also, double check that, on the configuration window titled “Configuring extra options”, that the box for Enable Git Credential Manager is checked.

Install Pandoc (for PDF support)

If you want to be able to generate PDF files, you will need to install the Pandoc application, which is a universial file format converter. To install Pandoc on your computer, run the following:


If you are on your personal computer or laptop, you can check the box to install for all users on the machine. If you are on a class or lab computer, do not check this box. After installing, it will suggest that you restart the computer and give you the option to say “Yes” or “No” in the Console window. If you are on a class or lab computer, type No and press enter.

Install MikTeX (for PDF support)

You also need LaTeX support to generate PDF files. On Windows, this is provided via the MikTeX package. This installation process can take a while, so it’s not recommended you do this if you immediately need to use RStudio for other tasks. To install MikeTex on your computer, run the following in the Console window:


If you are on your personal computer or laptop, select the option to install for “anyone who uses this computer”. If you are on a class or lab computer, select the “only for:” option. Select the following configuration options:

  • Preferred paper: Letter
  • Install missing packages on-the-fly: Yes

Installing RStudio software dependencies on Mac

The installr package does not work on Mac computers. For Macs, you will need to download and install Git, Pandoc, and MacTeX.

Installing RStudio software dependencies on Linux

The Linux lab and class computers should have these dependencies installed and available.


Some of these programs may require additional configuration to get them to work correctly.

Git initial setup

This should only need to be done one time per computer.

Launch RStudio, then click Tools -> Shell. If you’re on a Windows machine, this will open up a cmd.exe window (“DOS prompt”), and if you’re on Mac or Linux you will get a terminal window. In this window, type the following so that Git and Github can better know who you are, replacing “FirstName” and “LastName” with your full name, and replacing “” with your Mason email address.

git config --global "FirstName LastName"
git config --global

How to enter your Github username and password

Pushing to a Github repository requires you to provide your login information — otherwise, anybody would be allowed to make changes to your files. The following are instructions for how to do this using your Github username and password. If followed correctly, this will make your computer securely1 “remember” (cache) your username and password for about 16 weeks, meaning you should only need to follow these steps once per computer per semester. You can do this on as many computers as you would like2.

The procedure is different for Windows, Mac, and Linux computers, so we provide separate instructions for each.


Launch RStudio, then click Tools -> Shell. In the cmd.exe window, enter:

git config --global ghfw.disableverification true
git config --global credential.helper wincred

Mac (Unverified)

Launch RStudio, then click Tools -> Shell. To find out if the credential helper is already installed, in the terminal window enter:

git credential-osxkeychain

You should see a message that looks like Usage: git credential-osxkeychain <get|store|erase>. If you do not, follow step 2 on the GitHub help page.

Once you’ve confirmed you have the credential helper, enter:

git config --global credential.helper osxkeychain


Launch RStudio, then click Tools -> Shell. In the terminal window, type:

git config --global credential.helper 'cache --timeout=10000000'

This will store your password for ten million seconds (that’s roughly 16 weeks).

Trigger a username/password challenge

Change a file in your project and stage then commit it using the graphical interface in RStudio. Now, click Tools -> Shell and open the shell window and type the following:

git push -u origin master

You will be asked for your username and password. Enter these, and the push should complete and your username and password should hopefully be cached.

To check that the caching worked, try pushing a second time:

git push

You should NOT be asked for your username and password, instead you should see Everything up-to-date.

Rejoice and close the shell. From now on your “Push” button in RStudio will just work.


This guide is based on information found in the following sources:

  1. This means that your password will not be visible to other people using the computer.

  2. Repeating these steps on second computer does not “reset” anything on the first computer. It just means you now have two computers that won’t require you to re-enter your username and password for 16 weeks or so.