This is a quick tutorial on how to use GitHub Desktop to turn an RProject into a git repository!

Before you get started, make sure you have:

  • A GitHub account
  • GitHub Desktop installed on your computer
  • A folder containing an RProject that you’d like to convert to a git repository.
    • This may be the folder you’ve used to do your coursework in.

This demo was created using Windows, however the procedure should be very similar in MacOSX.

Step 1: Locate your project folder.

For this tutorial, I’m going to use a folder called test_repo. Here, I’ve located the folder test_repo in Windows Explorer.

Step 2: Create a backup.

It’s unlikely that you’ll run into any issues, but just to be safe, we’ll make a backup copy of your folder.

In Windows, it’s easy.

  1. Right-click your folder.
  2. Select the “Send to” item on the popup menu.
  3. Select Compressed folder on the submenu:

  1. You should end up with a zip file:

The procedure is very similar on Mac. Here’s a quick tutorial on zipping folders on Mac.

Step 3: Create the repo in GitHub Desktop

Now, fire up GitHub Desktop.

In the File menu, select “Add local repository…”:

Click the “Choose…” option in the popup:

This will bring up a file browser. Navigate to the folder containing your RProject and click the “Select Folder” button.

You’ll get a warning that the folder you selected is not a Git repository. The popup will give you the option to create a repository:

Click the link and it’ll bring up a new popup:

Click the “Create repository” button.

Step 4: Publish to GitHub.

Now you’re ready to publish your repository on GitHub. It’s easy in GitHub Desktop. Just click the “Publish repository” button:

You’ll see a new popup. Uncheck the “Keep this code private” option:

Click the “Publish repository” button and you’re done!

Step 5: Check on github.com

To verify that your repository was published, navigate to your github.com page and search for your new repository: