Setup · Get Ready¶
Goal
Before we touch a single git command, everyone gets fully set up:
- Git installed on your laptop
- A GitHub account
- Git configured with your identity
- Your laptop connected to GitHub (HTTPS or SSH)
~15–20 min · do this once and you're set for the whole workshop.
Which terminal do I use?
- macOS / Linux: the built-in Terminal.
- Windows: use Git Bash (it comes with Git — see step 1). All the commands on this site assume Git Bash, so Windows and Mac/Linux students type the same thing.
1. Is git installed? ¶
Open your terminal and run:
- You see something like
git version 2.40.0→ great, skip to step 2. - You see
command not found→ install it using the tab for your system:
- Download Git for Windows from git-scm.com/download/win.
- Run the installer and accept the defaults (they're sensible).
- This also installs Git Bash — open it and use it as your terminal from now on.
The quickest way installs Apple's command-line tools (which include git):
Prefer Homebrew? Then:
Confirm:
2. Create a GitHub account ¶
Show of hands
Already have a GitHub account? Sign in at github.com and skip straight to step 3. Only make a new one if you don't have one.
- Go to github.com and click Sign up.
- Use your university email, pick a username (this is public and professional —
anna-particlesbeatsxX_darkmatter_Xx), and set a password. - Verify your email (check your inbox for a code).
🎓 Student perk
Apply for the GitHub Student Developer Pack — free private repos, CI minutes, and tools. Do it later; approval can take a day.
3. Tell git who you are ¶
Git stamps every snapshot with your name and email. Set them once — use the same email you just used for GitHub:
Check it worked:
Tip
--global means "for all my projects on this laptop." You only do this once, ever.
4. Connect your laptop to GitHub ¶
To push and pull from a GitHub repo, your laptop has to prove who it is. There are two
ways to set that up — you only need one:
| HTTPS | SSH key | |
|---|---|---|
| Setup now | Nothing to generate | One-time key generation |
| Each push | Paste a token once, then it's cached | Nothing, ever |
| Best for | Getting started fast; shared / lab machines | Your own laptop, long term |
Which should I pick?
In a hurry? Use HTTPS (Option A) — you can start pushing in about a minute. If this is your personal laptop and you'd like truly passwordless pushes forever, set up an SSH key (Option B). You can always add SSH later; nothing here locks you in.
Option A · HTTPS (quickest)¶
With HTTPS you use https://… repo URLs and there's nothing to generate. The one
wrinkle is the identity/password step:
The HTTPS identity gotcha
On your first push, GitHub asks for a username and password — but it no
longer accepts your account password. In the password field you paste a Personal
Access Token (PAT) instead. Set it up once and git remembers it.
1 · Create a Personal Access Token
- GitHub → your avatar → Settings → Developer settings → Personal access tokens → Tokens (classic).
- Generate new token (classic), add a note like
my laptop, set an expiry, and tick thereposcope. - Click Generate token and copy it now — you won't see it again. Treat it like a password.
📖 GitHub docs: Creating a personal access token.
2 · Make git remember the token (so you paste it only once) by turning on a credential helper for your system:
Nothing to do — Git Credential Manager ships with Git for Windows and stores your token automatically after the first push (it may pop up a browser sign-in window).
For permanent storage instead, install Git Credential Manager.
You'll actually type the token on your first push in Session 2 — enter your username, then paste the token as the password. After that it's silent.
Even easier: the GitHub CLI
Installed gh? Run gh auth login → HTTPS → Login with a web browser. It
creates and stores the token for you — no manual PAT needed.
That's all HTTPS needs. You can stop here and move on to Session 1, or set up an SSH key below for passwordless pushes.
Option B · SSH key (passwordless after a one-time setup)¶
What is an SSH key, and why?
An SSH key is a pair of files: a private key that stays secret on your laptop, and a
public key you give to GitHub. Together they let your laptop prove who it is — so you
can push and pull without typing anything each time. It's the standard, secure
way to talk to GitHub. See GitHub's overview:
About SSH.
Generate the key¶
Run this in your terminal (Windows: Git Bash), using your GitHub email:
- When asked "Enter file in which to save the key" → just press Enter (accept the
default
~/.ssh/id_ed25519). - When asked for a passphrase → you may press Enter for none, or set one for extra security (you'd type it once per session).
📖 GitHub docs: Generating a new SSH key.
Add the key to the ssh-agent¶
The ssh-agent is a helper that holds your key in memory. Start it and add your key:
Start the agent:
Create or edit ~/.ssh/config so macOS remembers the key in your Keychain:
Then add the key:
Copy your public key¶
You'll paste this into GitHub. Copy it with the command for your system:
Public vs. private — don't mix them up
Only ever share the file ending in .pub (the public key). Never share or paste
id_ed25519 (no extension) — that's your private key and must stay secret.
Add the key to your GitHub account¶
- On GitHub: click your avatar → Settings → SSH and GPG keys.
- Click New SSH key.
- Title: something recognizable, e.g.
My laptop. - Key type: Authentication Key.
- Key: paste (Cmd+V / Ctrl+V) the public key you copied.
- Click Add SSH key.
📖 GitHub docs: Adding a new SSH key to your account.
Test the connection¶
The first time, it asks "Are you sure you want to continue connecting?" → type yes.
You should then see:
Hi your-username! You've successfully authenticated, but GitHub does not provide shell access.
That "does not provide shell access" part is normal and expected — it means it worked. 🎉
📖 GitHub docs: Testing your SSH connection.
You're ready¶
- [x]
git --versionworks - [x] You can sign in to GitHub
- [x]
git config --global --listshows your name and email - [x] You picked a connection method — HTTPS (token created + credential helper on)
or SSH (
ssh -T git@github.comgreets you by username)
Everyone at this point? Then let's actually learn git.