Git is a version control system – like “Track Changes” features from Microsoft Word.
GitHub is the home for your Git-based projects on the internet (like DropBox but much better).
There are a lot of Git commands and very few people know them all. 99% of the time you will use git to add, commit, push, and pull.
We will be using the GitHub Desktop application to perform the Git commands in a beginner-friendly way. Our local project in RStudio will be sent to GitHub using the application.
Accept the e-mailed GitHub invitation to join our course organization. If you did not receive an invitation, that means I do not have your GitHub username!
Go to https://desktop.github.com/ and download the GitHub Desktop application. Mac users: check if you need to download for Apple silicon Mac.
A zipped file will appear in your Downloads folder. Please unzip the file.
A purple GitHub Desktop icon with the octocat icon will appear. I suggest dragging this to your dock.
If so, check the box and choose the white “Not Now” button
Now we need to sync your GitHub Desktop application with your GitHub account
You will be directed to github.com to sign-in. Enter your account information. Once authenticated, your GitHub Desktop client should be set up!
In this course, I will create your GitHub repositories (i.e. projects) for you. I have a master repo, and I distribute copies to each one of you that only you (and in the future, your group members) can access
Go to the course organization on GitHub (either via github.com or by clicking on the octocat on the course website)
Find the repo with the prefix lab-01-roulette-
Click on the green Code button, and select the option Open with GitHub Desktop
The GitHub Desktop application will open up, with a white window that says “Clone a Repository”. Important: in the second line that says “Local Path”, there is a button that says Choose…
Click on it, and select the Math 218 folder you created from this course. Then hit the blue Clone
button.
When you work on a project locally (i.e. on your own machine), you will want to periodically “back-up” your changes in case something terrible happens to your laptop, or you need to share your progress with a team member
The process is done in stages:
Add
ing your changes,
Commit
ing your changes, and
Push
ing your changes
GitHub Desktop automatically does the add
step for you, but you need to explicitly commit
and push
!
lab-01-roulette.Rmd
file, and edit your name in the author
section of the YAML, then knit the document.Open GitHub Desktop and make sure the Current Repository is the project of interest.
add
step for you.Commit: on the bottom left:
Type a brief comment in the small text-box next to your GitHub profile photo/graphic.
Push the blue Commit to main
button.
Push: on the top right:
There should be a tab that says Push origin
with an upward arrow with a number next to it. That means you are ready! Click the button to push
your changes to origin.
You will know the push was successful if this tab returns to say Fetch origin
Go to the corresponding repository on github.com
Check to see if the current version of lab-01-roulette.Rmd
file has your updated author name. If it doesn’t, that means the push was not successful.
Not setting the “Current Repository” to the repository of interest
Forgetting to push after committing
Not pushing often enough (I suggest pushing every hour, or after you’re done working for the day)