Git, Github, Github Pages
Jeremy Springman
University of Pennsylvania
Global Development: Intermediate Topics in Politics, Policy, and Data
PSCI 3200 - Spring 2024
Installing git
- Open the terminal/command prompt
- Check if you have git installed
Installing git
If yes, consider running an update
git update-git-for-windows
Installing git
If no, install git
- Installation instructions
- Download
.exe
and double-click
- 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
git Basics
Git is a version control program, so you can avoid…
analysis.R
analysis_v1.R
analysis_v2.R
analysis_v2_FINAL.R
Git hosts data and code
- “Remote” (
main
) on github.com
- “Local” on your harddrive(s) in a designated folder
git Basics
Version control
- Helps avoid devastating loss/failure
- Precisely tracks changes and can revert to old versions
- Note: everything is public by default
Collaboration
- When you collaborate, it’s clear who to blame
- Simultaneous editing can cause challenges
git Basics
Basic commands
git pull origin main
git add .
git commit -m "describe your changes or vent frustration"
git push origin main
git 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
Install a git client
- Download GitHub Desktop
.exe
- Double click the
.exe
Clone your repo
Clone your repo
Commit changes
Push to your repo
Pull from your repo
Create a website
Moving to RStudio
- File \(\rightarrow\) New Project \(\rightarrow\) New Directory \(\rightarrow\) Quarto 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