Configuring RStudio Projects with Git Repositories


Scope

When working in RStudio, it is advisable to associate the project with a Git repository (aka repo). These steps detail a typical Git-related configuration and the associated set up steps in RStudio.

Creating a New RStudio Project from a Git Repository

Once Git and ssh key authentication have been configured on a Metworx workflow, RStudio can be setup to interact with Git repos.

For reference:

Retrieving Git Repo URL

Follow these steps retrieve a URL to the Git repo:

  1. On GHE/Github web interface, select your repo and click "Code"
  2. Select "SSH" as the protocol
  3. Copy the repo's URL onto your clipboard. git repo url

Create an RStudio Project

  1. On the Metworx RStudio IDE web interface, click "New Project" RstudioNewProject
  2. In the "New Project Wizard" dialog, select "Version Control" version control
  3. In the next screen, select "Git" as the version control method git version controll
  4. Paste the repo URL you copied earlier in the "Repository URL" section, enter a name for the project in the "Project Directory Name" section, and select your project's location in the "Create project as a subdirectory of" section clone repo details ,
  5. Click "Create Project", and your new RStudio Project will be created and your desired Git repository will be cloned there.

Within the project, you can now branch, commit, push, and pull to the repository from RStudio's Git pane (in addition to the RStudio Terminal).

To learn more about using Git and its associated functionality, you can view the Git related resources within the knowledgebase, starting with the Intro to Git article.

GIT interface in rstudio