Connecting Git with R-Studio

Enos Jeba
4 min readFeb 13, 2021

--

In a few simple steps.

First and foremost why do we need it ?

Git is good at version control. So integrating R with git will help you manage all your codes and workspace in a proper manner.

You would need

Once you have installed R-studio, Git and SVN

Step 1

Open R-studio and click on tool from taskbar and navigate to Global Options

Step 2

Navigate to “Git/SVN”. If you installation was performed correctly the directory to your git and svn will be mentioned.

Step 3

Click on “Create RSA Key”. On the new Pop-Up select “Create”. The RSA file will be stores in a directory (You can choose your own desired directory too).

Step 4

Click on “View public key” and copy all the contents inside it. The Key Begins with ‘ssh-rsa’, ‘ssh-ed25519', ‘ecdsa-sha2-nistp256’, ‘ecdsa-sha2-nistp384’ or ‘ecdsa-sha2-nistp521’ .

Step 5

Open Browser and Sign in to Github

Step 6

Go to your profile drop down and select settings.

Step 7

On the settings page select “SSH and GPG keys” option

Step 8

Paste the Key you copied in the Key Text Box. Add a title example R Studio. Once done Click add “SSH Key” It will be visible on the SSH key list

Step 9

Let’s Create Repository for our project. There are multiple ways to create a repository. Click on the “+” icon near your profile picture on the top right and select “New Repository” on the drop down list.

  • Name your Repository
  • Add Description
  • Choose if you want the mode to be private or public
  • Check out the list of optional requirements (“README file”, “.gitignore” and “Choose a License”)
  • Click on create repository

Step 10

Copy the repository URL

Step 11

Let’s go back on R-Studio and Create a new project

Step 12

Select Version Control

Step 13

Select Git

Step 14

Add the repository Url you copied and paste it in Repository Url box

Also select a subdirectory of the project and click on “Create Project”

Step 15

Now your R-studio will have a git tab either next to “Connections Tab” or “Terminal Tab”

Step 16

Create a new R-Script . And add your contents / Codes

Step 17

Save the script. The file will appear on the Git tab.

To upload Tick the staged checkbox next to the file name and then click on commit or push as required

That’s all. You did it.

Follow me on GitHub

*R-Studio requires R to be installed in order to wo

--

--

No responses yet