# MPPR 2026 — Pre-course setup packet

Use this packet **before 10 September** so Day 1 labs (R, R Markdown, git/GitHub) start without install delays.

## What’s inside

| File | Purpose |
|------|---------|
| `setup_mppr.sh` | macOS / Linux installer & Git HTTPS config |
| `setup_mppr.ps1` | Windows PowerShell installer & Git HTTPS config |
| `setup_env.R` | Installs course R packages and runs `verify_installation()` |
| `README.md` | This guide |

## Quick start

### macOS / Linux

```bash
cd /path/to/mppr-prep-packet
chmod +x setup_mppr.sh
./setup_mppr.sh
```

### Windows (PowerShell)

```powershell
cd C:\path\to\mppr-prep-packet
Set-ExecutionPolicy -Scope Process Bypass
.\setup_mppr.ps1
```

The script will:

1. Install or detect **Git**
2. Configure your Git name/email
3. Force **HTTPS** GitHub URLs (no SSH keys)
4. Set a **credential helper** so tokens are remembered
5. Install or detect **R (≥ 4.3.1)**
6. Point you to **RStudio / Posit Desktop** if missing
7. Run **`setup_env.R`** to install packages

## Git: avoid SSH keys and one-time-password pain

For this course we standardise on **HTTPS + Personal Access Token (PAT)** (or GitHub CLI browser login).

### Do this

1. Create a free [GitHub](https://github.com/) account if you do not have one.
2. Create a **classic PAT**: https://github.com/settings/tokens  
   - Scopes needed for class work: **`repo`**
3. Always clone with HTTPS:

   ```bash
   git clone https://github.com/OWNER/REPO.git
   ```

4. When Git asks for a **password**, paste the **PAT** (not your GitHub account password).
5. Let Git Credential Manager / macOS Keychain store it so you are not prompted every time.

### Optional easier login (recommended)

```bash
# After installing GitHub CLI (gh)
gh auth login
# Choose: GitHub.com → HTTPS → Login with a web browser
```

### Do **not** do this (unless you already know SSH well)

- Do not generate SSH keys for class repos.
- Do not use `git@github.com:…` remotes.
- Do not rely on SMS / OTP every push — that usually means password auth instead of a stored PAT/GCM session.

The setup scripts rewrite accidental SSH GitHub URLs to HTTPS:

```text
git@github.com:ORG/REPO.git  →  https://github.com/ORG/REPO.git
```

## R packages only

If Git/R are already installed:

```bash
Rscript setup_env.R
```

Or in RStudio:

```r
source("setup_env.R")
verify_installation()
```

## Manual downloads (if the script cannot install)

- R: https://cran.r-project.org/
- RStudio: https://posit.co/download/rstudio-desktop/
- Git: https://git-scm.com/downloads
- GitHub CLI: https://cli.github.com/

## Help

Email **info@g-wac.org** with your operating system and the exact error text.
