RStudio Pilot migration – migrating your code to GitLab

This article details the steps to migrate your source code from RStudio to the UW-Madison instance of GitLab.

Migrating your code from RStudio to GitLab

Managing your code is a crucial step in making your research reproducible. Git is a version control system used for tracking changes in computer files. It is generally used for source code like the code you created in RStudio. You can learn about the benefits of using git and managing your code with repositories here and here.

GitLab is a web-based Git repository that provides both public and private repositories. DoIT manages an instance of GitLab free of charge for campus researchers. However, if you are planning to leave campus, you can still get a free account with GitLab or Github. Both have generous licenses for individuals. 

  1. Install Git on your computer

GitLab runs on top of Git. You can follow these steps to install Git on your computer. 

  1. Request a GitLab account 

As a UW-Madison faculty, staff, student or other researcher, you can request a GitLab account here

  1. Create a repository for your R code 

You need to create a repository into which you will migrate your code. Follow these steps to migrate your code into the repository

  1. Create a repository. Click the New Project button or click the disclose triangle next to the "+" sign and then click the New Project/Directory

  1. Pick the Create Blank Project option.

Shows in the GUI where the Black Project option is

  1. Choose a name and location for your project. Chose the appropriate visibility, i.e., Public if you anticipate sharing with audiences outside UW-Madison, Internal for inside campus sharing, or Private if sharing will not be allowed. You can change these settings later.  

Shows in the GUI where the fields are for project name and project visitibility

  1. Copy the HTTPS link to your repository. 

Shows in the GUI where the url for the repository is

  1. Migrate your code 

You will need to use the Terminal on your computer to complete these steps. 

  1. Make the directory of your project a git directory by running

git init 

  1. Add the files you want to track. This will track all your files. Modify as needed

git add .

  1. Commit the files and add an informative commit message

git commit -m “first commit message” 

  1. Add the remote repository you just created in Step 3 above by running:

git remote add origin git@git.doit.wisc.edu:<name-of-your-repository>

  1. Make sure you are on the main branch

git branch -M main

  1. Push the context of your code folder/directory to the GitLab repository

git push -uf origin main  




Keywords:rstudio pilot, data science platform, RCI, gitlab   Doc ID:120717
Owner:Erwin L.Group:UW-Madison Research Data
Created:2022-08-16 11:59 CSTUpdated:2022-08-19 14:31 CST
Sites:UW-Madison Research Data
Feedback:  0   0