You only have to set this up once per machine.
RStudio can only act as a GUI front-end for Git if Git has been successfully installed AND RStudio can find it.
A basic test for successful installation of Git is to simply enter git in the shell. If you get a complaint about Git not being found, it means installation was unsuccessful or that it is not being found, i.e. it is not on your PATH.
If you are not sure where the Git executable lives, try this in a shell:
which git (Mac, Linux)
where git (most versions of Windows)
whereis git.exe (some other versions of Windows)
If Git appears to be installed and findable, launch RStudio. Quit and re-launch RStudio if there’s any doubt in your mind about whether you opened RStudio before or after installing Git.
From RStudio, go to Tools > Global Options > Git and make sure that the box Git executable points to … the Git executable. It should read something like:
/usr/bin/git (Mac, Linux)
C:/Program Files (x86)/Git/bin/git.exe (Windows)
Here is a screenshot of someone doing this on a Windows machine.
C:/Program Files (x86)/Git/cmd/git.exe. The difference between the good and bad paths is bin vs. cmd.Restart RStudio if you made any changes. Don’t make me stop this car and restart R and RStudio for you in office hours. DO IT.
We will create a new dummy “Project” and direct RStudio to put it under version control
File > New Project.... You should see a pop up like this.test. You can delete this very soon.test directory/Project.If this has not gone well, here is another thing to try:
Tools > Project Options.... If available, click on “Git/SVN” and select “Git” in the Version control system dropdown menu. Answer “yes” to the “Confirm New Git Repository” pop up. Answer “yes” to the “Confirm Restart RStudio” pop up.If none of this works, get help from us.