Github-first workflow
Click on assignment link
The first step to get code I’m providing to you is to click on the link to the Github Classroom “assignment.” (Maybe this link will take you to our classroom? Otherwise, click on the link I’ve provided for a particular assignment.)
Github may ask you to authorize Github classroom, you should click Authorize github to allow access.
Then, you need to accept the assignment,
doing this makes a copy of my code into a new Github repository with a similar name, but your Github username appended. For example, our first assignment was called hw1viz
, and when I used my student Github account (called amelia-student
) I got a new repository called hw1viz-amelia-student
.
This is analogous to “forking” a repository in standard Github. We’re making a copy, but just working on the website of Github
Copy the git URL
Our next big goal is to get the code from Github into our RStudio. But, this takes a couple steps. The first one is to copy the URL to your repository.
Click the “Clone or Download” button, and then copy the URL there. Make sure it says “Clone with HTTPS” at the top.
Make new RStudio Project
Go to your rstudio.cloud, and within our STAT360 workspace, click the dropdown next to New Project and selct “New Project from Git Repo”
In the pop-up window, paste the URL of the git repostory that you copied in the previous step
RStudio will ask you to enter your Github username and password. Enter those, and be patient as RStudio generates a new project.
Don’t try to edit the name of the project yet, as that will make the import from Github fail. Another way it fails is if you enter your Github username and/or password incorrectly. This is a fragile point in the process! If it doesn’t work, go back to the STAT360 workspace and try making a new project again.
Introduce yourself to git
Perhaps the most annoying part of this process is that you have to (re)introduce yourself to git every time you make a new project. I asked RStudio, and that’s really what you have to do.
To introduce yourself to git, open the Terminal (the tab next to the Console)
In that window, type each of these statements, one at a time, and then hit Enter.
git config --global user.name 'Jane Doe'
git config --global user.email 'jane@example.com'
git config --global credential.helper 'cache --timeout 3600'
git config --global --list
Remember to write your name where it says Jane Doe, and your email address where it says jane@example.com
. The cache timeout stuff will make RStudio remember your Github username/password for an hour.