Git runs on all three platforms. The setup is slightly different depending on where you are.
Windows (WSL 2)
You set up WSL 2 in the Terminal chapter. In this chapter, use Git inside Ubuntu, not Windows. If you install Git in both places, they act like separate setups and won’t share the same history, settings, or SSH keys. Every command here should be run in Ubuntu.
Open your Ubuntu app:
sudo apt install git diffutilsmacOS
Git ships with the Xcode Command Line Tools:
xcode-select --installA dialog will appear; follow the prompts. Verify when it finishes:
git --versiondiff and patch install alongside it.
Linux
# Debian / Ubuntu
sudo apt install git diffutilsConfigure your identity
Every commit you make will carry your name and email address. Not as a formality — these values are embedded in the commit object itself and travel with it forever. When someone clones your repository two years from now, they will see them attached to every commit you made.
Set them once:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"--global writes to ~/.gitconfig and applies to every repository
on this machine. Verify:
git config --listSSH key
When you push to GitHub, GitHub needs to confirm that you are who you say you are. It does this with SSH — a protocol for secure authentication between machines.
SSH uses a key pair: a private key that stays on your machine and never leaves it, and a public key you share with GitHub. When you push, GitHub issues a cryptographic challenge that only your private key can answer correctly. No password is sent over the wire. Once the key is registered, authentication is automatic.
Generate a key pair:
ssh-keygen -t ed25519 -C "[email protected]"Accept the default file location (~/.ssh/id_ed25519). You can set
a passphrase or leave it empty — a passphrase adds protection if
someone gains access to your machine, at the cost of typing it on
each use.
Print the public key:
cat ~/.ssh/id_ed25519.pubAdd it to GitHub: Settings → SSH and GPG keys → New SSH key. Paste the output, give the key a descriptive name (the machine it lives on is a sensible choice), and save.
Verify the connection:
ssh -T [email protected]Expected: Hi <username>! You've successfully authenticated, but GitHub does not provide shell access.
You only do this once per machine.