Install & set up¶
By the end of this lesson you'll have an Ubuntu terminal with Git installed and connected to your GitHub account.
Do this before the workshop
Installing Ubuntu can take 20–30 minutes and, on Windows, a restart.
1. Get an Ubuntu terminal¶
TODO: pick the club's Ubuntu version
These steps install the current Ubuntu LTS. Use the same version as the ROS 2 workshop so people only install it once.
Use WSL (Windows Subsystem for Linux), which runs Ubuntu inside Windows.
- Right-click Start → Terminal (Admin) or PowerShell (Admin).
-
Run:
This installs WSL with Ubuntu.
-
Restart your computer when asked.
- Open Ubuntu from the Start menu. The first launch asks you to create a Linux username and password. The password doesn't show while you type; that's normal.
Use Multipass, which runs a lightweight Ubuntu virtual machine.
- Download and install Multipass.
-
Open Terminal and run:
-
Your prompt changes to
ubuntu@ubuntu:~$. You're now inside Ubuntu. Next time, open Terminal and runmultipass shell ubuntuto get back.
You're all set. Open Terminal with Ctrl+Alt+T.
From here on, every command goes in your Ubuntu terminal.
2. Install Git and the GitHub CLI¶
sudo runs a command as administrator, so it asks for your Ubuntu password. gh is the GitHub command-line tool, which handles logging in to GitHub.
Check that both installed:
3. Tell Git who you are¶
Every commit is labelled with a name and email. Use the email address on your GitHub account.
Set a few sensible defaults:
git config --global init.defaultBranch main
git config --global pull.rebase false
git config --global core.editor nano
| Setting | What it does |
|---|---|
init.defaultBranch main |
New repos start on a branch called main, matching GitHub |
pull.rebase false |
git pull merges changes in (we'll cover this in lesson 8) |
core.editor nano |
Git opens the simple nano editor when it needs you to type a message |
4. Log in to GitHub¶
Answer the prompts:
- Where do you use GitHub? →
GitHub.com - Preferred protocol? →
HTTPS - Authenticate Git with your GitHub credentials? →
Yes - How would you like to authenticate? →
Login with a web browser
Copy the one-time code it shows, press Enter, and paste the code into the browser page. On WSL or Multipass the browser may not open by itself; go to https://github.com/login/device yourself.
Check that it worked:
Why not just use my GitHub password?
GitHub doesn't accept account passwords for git push. gh auth login sets up a secure token for Git so you never have to deal with one.
Checklist¶
-
git --versionprints a version -
git config --global user.emailprints your GitHub email -
gh auth statussays you're logged in