Clone the GitHub repositories


The below information illustrates the process for the server site package repository only. Follow the same route to clone the client site package repository.

Amending functions already written

This tutorial focuses on writing packages from scratch. However, to amend a function from a package already written the developer can follow the same route to clone the repository which holds the function and amend the code from his branch.

Clone the server site package repository

This is equivalent to copying over the repository/package, in GitHub, into your local computer where most of your development is going to take place. The version you will have on your computer will be linked to the one on GitHub. Go to the GitHub page of the package and copy the URL on the bottom left corner of the page, under HTTPS clone URL.

Once you have copied the URL go back to your local computer and start your Rstudio. In your Rstudio go to File and under that tab select New Project. A window with the title New Project will then pop up; in that small window click on Version Control and then on Git. Fill in the details required as shown in the below image:

  • Under Repository URL paste or type in the URL you got from GitHub earlier
  • The Project directory name should be the name of the package
  • Choose a location for your project folder/directory
  • Click on the button Create Project to finish

Git error for Windows users

If you are developing from a Windows environment you might experience the error shown on the below image. When you click on Git in the window New Project the process stops and the message below is displayed. Follow the instructions in the last section on this page to hopefully solve the problem. This worked on the computer with a Windows 7 operating system I tried it out. There is no guarantee that it will work on other Windows version or even on other Windows 7 machine since the file architecture might be different.

Possible solution for the issue of Git and Rstudio not linking up in Windows

  • Search for the file git.exe in your C drive, if that is your main drive (you might need to show hidden files and folders!). In the Windows 7 machine I used the file was located under C:\Users\MyUserName\AppData\Git\Gitxxxxxxplentyofnumbers\git.exe. Mark down the location of the file.
  • Get back to your Rstudio and do the following:
    • Go to the tab Tools, then select Global Options.
    • In the options go to Git/SVN and under Git executable browse to the location of the git.exe file and select the file. Click on Apply and OK.
  • Start over the cloning process again and now it should work.

DataSHIELD Wiki by DataSHIELD is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Based on a work at http://www.datashield.ac.uk/wiki