Version Control: Additional Topics

Using the Shell

RStudio provides an interface to the most common version control operations including managing changelists, diffing files, committing, and viewing history. While these features cover basic everyday use of Git and Subversion, you may also occasionally need to use the system shell to access all of their underlying functionality.

RStudio includes functionality to make it more straightforward to use the shell with projects under version control. This includes:

  • On all platforms, you can use the Tools -> Shell command to open a new system shell with the working directory already initialized to your project's root directory.
  • On Windows when using Git, the Shell command will open Git Bash, which is a port of the bash shell to Windows specially configured for use with Msys Git (note you can disable this behavior and use the standard Windows command prompt instead using Options -> Version Control).
  • On Windows when using Subversion, RStudio opens a shell with a PATH configured to use a version of ssh.exe which ships with RStudio (required for svn+ssh connections, see below).
  • When running over the web, RStudio provides a web-based shell dialog.

SSH

Version control repositories can typically be accessed using a variety of protocols (including http and https). Many repositories can also be accessed using SSH (this is the mode of connection for many hosting services including GitHub and R-Forge).

In many cases the authentication for an SSH connection is done using public/private RSA key pairs. This type of authentication requires two steps:

  1. Generate a public/private key pair
  2. Provide the public key to the hosting provider (e.g. GitHub or R-Forge)

To make working with RSA key pairs more straightforward the RStudio Version Control options panel can be used to both create new RSA public/private key pairs as well as view and copy the current RSA public key.

While Linux and Mac OSX both include SSH as part of the base system, Windows does not. As a result the standard Windows distribution of Git (Msysgit, referenced above) also includes an SSH client.

Subversion for Windows however does not include an SSH client. To overcome this limitation, RStudio includes a version of the Msys SSH client within the RStudio\bin\msys_ssh directory. This directory is automatically added to the PATH (for RStudio only rather than system-wide) and is also available on the PATH for command prompt windows opened using the Tools -> Shell command. A Windows shortcut (SSH Command Prompt) is also provided within the RStudio\bin\msys_ssh directory if you wish to launch a console from the Desktop that supports the svn+ssh protocol.

Related Topics