It looks like a lot of steps here; just be patient and follow each step in order. I’ve put checkboxes at the start of each step so you can check them off as you go.

1 Get a GitHub or GitLab account

1.1 Choose a username

  • Make sure your username is professional

  • Use a professional email address that you won’t lose access to (e.g., gmail)

1.2 Create a new repository

On GitHub, create a new repository.

On GitLab, create a new project.

2 Set up RStudio

2.1 R, RStudio, and git

If you are a UofG INP staff/student, you can access the Glasgow Psychology RStudio site and skip the rest of this step.

If you are working from your own computer, follow the next 3 sub-steps:

2.1.1 Install R and RStudio

2.1.2 Install git

You can check if git is already installed on your computer by going to Shell... under the Tools menu (or just open a terminal window) and typing which git. If you get an answer like /usr/local/bin/git then git is already installed. If not, install git and then use which git to check where it is installed.

2.1.3 Enable version control in RStudio

Go to Global Options... from the Tools menu and set the location of your Git executable to the location from the previous step.

2.2 Set your git info

Go to Shell... under the Tools menu and paste in the following text. Make sure to replace GITHUBLAB_EMAIL with the email address you used for github/lab and GITHUBLAB_USERNAME with your github/lab username.

git config --global user.email "GITHUBLAB_EMAIL"
git config --global user.name "GITHUBLAB_USERNAME"

2.3 Create an SSH Key on RStudio

2.3.1 Go to Global Options... from the Tools menu

2.3.2 Click Create RSA Key… and enter a passphrase

2.3.3 Click on View public key and copy the contents of the box

2.4 Create an SSH Key on GitHub/GitLab

2.4.2 On GitHub, click New SSH Key

2.4.3 Put RStudio server as the title (or My Computer Name if on your own computer)

2.4.4 Paste your public key into the Key box

2.4.5 Click Add SSH key (GitHub) or Add key (GitLab)

Now you are ready to create your first project!