Week 1: Git, GitHub, and the Command Line¶
Overview¶
This session does double duty: it teaches the foundational tools (git, terminal, GitHub) and sets the stage for the entire course. The core argument is simple: AI coding agents like Claude Code are extraordinarily powerful, and that power is exactly why you need version control, quality assurance (QA), and structured workflows.
Learning Objectives
- Describe the current landscape of AI coding agents and how they fit into research workflows
- Explain why AI-powered productivity demands stronger quality assurance, not weaker
- Navigate the filesystem using
cd,ls,pwd,mkdir - Initialize a git repository, stage files, commit, push to GitHub
- Understand the difference between
git(version control) andgh(GitHub CLI) - Create branches, pull requests, and issues on GitHub
Slides¶
Setup Guide¶
A step-by-step walkthrough for getting your research computing environment ready. No prior coding experience is assumed.
1. Open Your Terminal¶
Every operating system has a built-in terminal. This is where you type commands instead of clicking buttons.
- Open Spotlight (Cmd+Space), type
Terminal, press Enter - Or find it in Applications > Utilities > Terminal
- Press Ctrl+Alt+T (most distributions)
- Or search for "Terminal" in your application launcher
Install Windows Subsystem for Linux (WSL). Open PowerShell as Administrator and run:
Restart your computer, then open "Ubuntu" from the Start menu. WSL gives you a full Linux terminal inside Windows.
Once your terminal is open, verify it works:
2. Install a Package Manager¶
Package managers let you install software from the command line. Think of them as an app store for developer tools.
3. Install Git and the GitHub CLI¶
You need two command-line tools: git for version control and gh (the GitHub CLI) for interacting with GitHub.
Verify both:
Configure your git identity (use the same email you will use for GitHub):
4. Understanding git vs gh¶
These two tools work together but handle different things:
git | gh | |
|---|---|---|
| What it is | Version control system | GitHub CLI |
| What it does | Tracks file changes, manages history | Manages GitHub features (issues, PRs, repos) |
| Works without GitHub? | Yes | No |
| Installed by default? | Sometimes (macOS ships a version) | No |
git commands you will use daily:
git init # Start tracking a folder
git add file.md # Stage a file
git commit -m "" # Save a snapshot
git push # Send to remote
git pull # Get updates
git log --oneline # View history
git diff # See what changed
git clone <url> # Copy a remote repo locally
gh commands for GitHub operations:
gh repo create # Create a new GitHub repo
gh repo clone # Clone a GitHub repo (shorthand)
gh issue create # Open an issue
gh issue develop # Create a branch from an issue
gh pr create # Open a pull request
gh pr view # View PR details
Where they overlap
Both can clone a repository (git clone <url> vs gh repo clone user/repo). That is essentially the only overlap. In practice, you use git for all version control and gh for all GitHub operations.
5. Create a GitHub Account¶
If you do not already have one:
- Go to github.com
- Click Sign up
- Choose a username, enter your email, create a password
- Verify your email address
GitHub Education (free upgrades for researchers)¶
GitHub offers free benefits for students, faculty, and research labs. These are worth setting up before you go further.
Apply for the GitHub Student Developer Pack:
- Go to education.github.com/students
- Click Join Global Campus
- Verify your academic status (use your
.eduemail or upload proof of enrollment) - Once approved, you get GitHub Pro for free, plus access to dozens of developer tools
Benefits include unlimited private repos, GitHub Copilot access, and free domain names.
Apply for the GitHub Teacher Toolbox:
- Go to education.github.com/teachers
- Click Join Global Campus
- Verify your academic status with your institutional email
- Once approved, you get GitHub Pro and can create free GitHub Classroom organizations
If your lab or research group has a GitHub organization, you can upgrade it to GitHub Team for free:
- Visit education.github.com/globalcampus/teacher (you must be verified as faculty first)
- Find the Upgrade your academic organizations section
- Click Upgrade to GitHub Team
- Select your organization and click Upgrade
This gives your entire lab access to GitHub Team features for free: protected branches, required reviews, code owners, advanced audit logs, and more. Highly recommended for any research group managing shared code.
Set up SSH keys (recommended)¶
SSH keys let you push to GitHub without typing your password every time.
Press Enter to accept the default file location. You can set a passphrase or press Enter for none.
Then add it to GitHub:
- Go to github.com/settings/keys
- Click New SSH key
- Paste your key and give it a title (e.g., "My Laptop")
- Click Add SSH key
Test the connection:
You should see: Hi username! You've successfully authenticated...
Authenticate the GitHub CLI¶
Follow the prompts: select GitHub.com, choose SSH, and authenticate through your browser.
6. Terminal Navigation Basics¶
pwd # Print working directory (where you are)
ls # List files and folders
cd Documents # Change directory
cd .. # Go back up one level
mkdir my-project # Create a new folder
cd my-project # Move into it
Key concepts
- Absolute path: starts from the root, e.g.,
/Users/jane/Documents - Relative path: starts from where you are, e.g.,
Documents/projects ..means "one directory up".means "this directory"~means your home directory
7. Create Your First Repository¶
# Create a project folder and move into it
mkdir my-research-project
cd my-research-project
# Initialize git tracking
git init
Create a file and make your first commit:
# Create a README
echo "# My Research Project" > README.md
echo "" >> README.md
echo "This is my first git repository." >> README.md
# Stage and commit
git add README.md
git commit -m "Add README with project description"
Make a few more commits to practice:
# Add a notes file
echo "## Research Notes" > notes.md
echo "" >> notes.md
echo "- Started project setup" >> notes.md
git add notes.md
git commit -m "Add initial research notes"
# Update the README
echo "" >> README.md
echo "## Goals" >> README.md
echo "- Learn git and GitHub" >> README.md
echo "- Set up a reproducible workflow" >> README.md
git add README.md
git commit -m "Add project goals to README"
View your history:
8. Push to GitHub¶
Create a remote repository:
- Go to github.com/new
- Name it
my-research-project - Leave it public (or private, your choice)
- Do not check "Add a README" (you already have one)
- Click Create repository
Connect and push:
git remote add origin git@github.com:YOUR-USERNAME/my-research-project.git
git branch -M main
git push -u origin main
Refresh the GitHub page. Your files and commits are now online.
9. Verify Everything Works¶
git --version # Git is installed
gh --version # GitHub CLI is installed
pwd # You are in your project
git status # Git is tracking the project
git log --oneline # You have commits
git remote -v # Your remote is set
If all of these work, you are ready for Week 2.
Before Next Session¶
Install Claude Code
Before Week 2, install Claude Code:
Verify:
We will walk through the full setup together in Week 2.
Quick Reference¶
Terminal¶
| Command | What it does |
|---|---|
pwd | Print current directory |
ls | List files |
cd <dir> | Change directory |
mkdir <name> | Create a directory |
Git (version control)¶
| Command | What it does |
|---|---|
git init | Start tracking a folder |
git status | See what changed |
git add <file> | Stage a file for commit |
git commit -m "msg" | Save a snapshot |
git push | Send commits to GitHub |
git pull | Get updates from GitHub |
git log --oneline | View commit history |
git diff | Show uncommitted changes |
git clone <url> | Copy a remote repo |
GitHub CLI (gh)¶
| Command | What it does |
|---|---|
gh auth login | Authenticate with GitHub |
gh repo create | Create a new repository |
gh repo clone user/repo | Clone a GitHub repo |
gh issue create | Open a new issue |
gh issue develop <num> | Create a branch from an issue |
gh pr create | Open a pull request |
gh pr view | View pull request details |
Resources¶
- Git documentation
- GitHub Skills (free interactive courses)
- Course repository
- Open Science Collective Discord
- research-skills plugin