
Once we have saved our edited files, we can use RStudio to commit the changes by clicking on “Commit…” in the Git menu: Now let’s add some additional information about Pluto: To edit the existing files in the repository, we can click on them in the “Files” panel on the lower right. RStudio has recognized that the current directory is a Git repository, and gives us a number of tools to use Git:

Notice the vertical “Git” menu in the menu bar. Ta-da! We have created a new project in RStudio within the existing planets repository. Click “Browse…” and navigate to the correct directory, then click “Create Project”: Next, RStudio will ask which existing directory we want to use.
GIT IN RSTUDIO FOR MAC LICENSE
Note: Even if you have Git installed, you may need to accept the XCode license if you are using macOS. In RStudio, go to the Tools menu > Global Options > Git/SVN and then browse to the git executable you found in the command prompt or shell.

NOTE: The path on your computer will be somewhat different. On one Windows computer which had GitHub Desktop installed on it, the path was: C:/Users/UserName/AppData/Local/GitHubDesktop/app-1.1.1/resources/app/git/cmd/git.exe Next open your shell or command prompt and type which git (Mac, Linux), or where git (Windows).
GIT IN RSTUDIO FOR MAC INSTALL
If there is no version of Git on your computer, please follow the Git installation instructions in the setup of this lesson to install Git now.
GIT IN RSTUDIO FOR MAC MAC
Open your shell on Mac or Linux, or on Windows open the command prompt and then type: Find your Git Executiableįirst let’s make sure that Git is installed on your computer. If that option is not present, it probably means that RStudio doesn’t know where your Git executable is, and you won’t be able to progress further in this lesson until you tell RStudio where it is. That is what you would click on if you wanted to create a project on your computer by cloning a repository from GitHub.

Since that repository lives in a directory on our computer, we choose the option “Existing Directory”: Do You See a “Version Control” Option?Īlthough we’re not going to use it here, there should be a “version control” option on this menu. Let’s say that we want to use RStudio with the planets repository that we already made. This will open a dialog asking us how we want to create the project. To get started using Git in RStudio, we create a new project: To be able to track the development of the project over time, to be able to revert to previous versions, and to collaborate with others, we version control the Rstudio project with Git. RStudio allows us to create a project associated with a given directory to keep track of various related files. While some advanced Git features still require the command-line, RStudio has a nice interface for many common Git operations. For that reason, the popular development environment RStudio for the R programming language has built-in integration with Git. Version control can be very useful when developing data analysis scripts.
