Github Pages

Jeremy Springman

University of Pennsylvania

Global Development: Intermediate Topics in Politics, Policy, and Data

PSCI 3200 - Spring 2024

Logistics

Assignments and Upcoming

  • Today
    • Submit the link to your github page
  • Thursday
    • Guest lecture: Maria Nagawa on State Capacity
    • Please do the readings
  • April 30
    • Final Project Assignment 2

Git and Github

Installing git

  1. Open the terminal/command prompt
  2. Check if you have git installed
git --version

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

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


  1. Open the terminal and enter the code below
  2. Replace "Your Name"and "yourname@email.edu" with your name/email used to sign up for GitHub
  3. 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

  1. Download GitHub Desktop .exe
  2. 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

Where we left off

  • 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 _site folder (now its using docs)
  • Create data folder to store your dataset
  • Add final project .qmd file to your repo (or drop it into index.qmd)
  • Use _quarto.yml to add new pages to navigation bar
  • Render index.qmd; confirm that other pages have been rendered
  • Push commit and check that the website updated