The target audience
I’m writing this primarily for students I’ll be teaching in Spring 2023 who I want to use Git/Github with Posit Workbench.
- This tutorial is appropriate for:
-
Anyone using RStudio/RStudio Server/Posit Workbench/Posit Cloud
- I will assume:
-
- Git is already installed and available.
- You have not already configured Git locally.
- You cannot access the terminal.
If item number 1 is not correct, or you want more detail on using Git and Github with RStudio, you should check out Jennifer Bryan’s much more extensive Happy Git and GitHub for the useR.
Item number 2 might be a strange assumption, but the Posit Workbench configuration I have access to actually does not allow opening a terminal.
Instruction boxes with should be done on github, and instruction boxes with should be done in RStudio.
Step 1: Create a Github Account
Go over to Github and create a free account.
As suggested in Happy Git Chapter 4, it would make sense to register an account username that aligns with your professional identity.
After you’ve created your free account, if you are affiliated with a university, I would also suggest applying for the education benefits here: https://education.github.com/. There are a few nice, but not mandatory, perks.
Step 2: Configure Git in RStudio
Now, you need to tell Git a little bit about yourself on the computer/server you’re using RStudio on.
Next, we need to tell the local version of Git who you are, specifically your username (which should match your Github username) and your email address (which should match the email address you registered for Github with).
Step 3: Configure RStudio to Communicate with Github
In order to be able to push commits from RStudio to Github, you’ll need to set up secure communication between wherever you are using RStudio and Github. I’ll walk you through how to do this with SSH credentials. (See also Happy Git with R for personal access tokens via HTTPS).
RStudio Configuration
This concludes everything necessary on the RStudio side of things. You should probably keep the session open so that you can come back to re-copy your public key.
Github Configuration
Now, you’ll need to go over to github to add the public key to your profile.
Configured
Now, wherever you are using RStudio from should be able to push commits to your Github account.
Reuse
Citation
@online{fruehwald2022,
author = {Fruehwald, Josef},
title = {Github {Onboarding} with {RStudio}},
series = {Væl Space},
date = {2022-12-21},
url = {https://jofrhwld.github.io/blog/posts/2022/12/2022-12-21_github-onboarding/},
langid = {en}
}