Git, Github, Github Pages
Logistics
Final Project Assignments
- Expect feedback on Research Question and Data by Wed EOD
- Next deadline is March 5
Warning
Late assignments deduct 2 points per day
Final Project Assignments
| Milestone | Due Date |
|---|---|
| Create a GitHub repository | Feb 17 |
| Research Question and Data | Feb 19 |
| Research Design | Mar 5 |
| Submit proposal | Apr 2 |
| Submit final project | May 10 |
Git and Github
- Before we talk about git, let’s start the installation process
Installing git
- Open the terminal/command prompt
- Check if you have git installed
git --version
Installing git
If yes, consider running an update
git update-git-for-windowsInstalling git
If no, install git
- Installation instructions
- Download
.exeand double-click
- Download
- Two things to watch for:
- Adjusting the name of the initial branch: Override the default branch name (select ‘main’)
- Adjusting your PATH: make sure to select command line and 3rd-party
Installing git

Installing git

Installing git

Installing git

Installing git

git Basics
Git is a version control program, so you can avoid…
analysis.R
analysis_v1.R
analysis_v2.R
analysis_v2_FINAL.RVersion control allows you to precisely track changes

git Basics
Show off your productivity

Share projects publicly

git Basics
Git hosts data and code
- “Remote” (
main) on github.com - “Local” on your harddrive(s) in a designated folder
- Resembles Dropbox/Drive synch + Version history
- Many advantages; a few disadvantages
git Basics
Version control
- Precisely tracks changes
- Revert to old versions
- Avoid devastating loss
- Note: everything is public by default
git Basics
Collaboration
When you collaborate, it’s clear who to blame
Simultaneous editing can cause challenges

Please don’t create conflicts with yourself
git Basics
Basic commands
git pull origin maingit add .git commit -m "describe your changes or vent frustration"git push origin maingit pull origin main
git Basics
Git can be complicated
- Often used for serious software development
- Branches, conflicts, merges, rebase
- Massive online community to help with more sophisticated use
Connect your GitHub account
- Open the terminal and enter the code below
- Replace
"Your Name"and"yourname@email.edu"with your name/email used to sign up for GitHub - Run the code
git config --global user.name "Your Name"
git config --global user.email "yourname@email.edu"Connect your GitHub account
Check that the confirmation worked
git config --list
Install a git client
- Download GitHub Desktop
.exe - Double click the
.exe

Install a git client

Clone your repo

Clone your repo

Clone your repo

Commit changes

Push to your repo

Pull from your repo

Github Pages
Create a website
Moving to RStudio
- File \(\rightarrow\) New Project \(\rightarrow\) New Directory \(\rightarrow\) Quarto Website

Create a website

Create a website
Change output director to docs

Publish to Github pages
- Keep a repository of your website
- Push changes to your website via Github
- See changes almost instantly
Publish to Github pages
- Publish local git repo to github.com
- Uncheck ‘Keep this code private’
- Open repo on github.com
- Settings \(\rightarrow\) Pages (left-sidebar)
Publish to Github pages

Publish to Github pages

Publish to Github pages

Publish to Github pages

Publish to Github pages

Publish to Github pages

Host Your Final Project
- Delete
_sitefolder (now its usingdocs) - Create
datafolder to store your dataset - Add final project
.qmdfile to your repo (or drop it intoindex.qmd) - Use
_quarto.ymlto add new pages to navigation bar - Render
index.qmd; confirm that other pages have been rendered - Push commit and check that the website updated