Install Git on Windows, macOS, and Linux¶
This workshop requires Git to be installed on your local machine. Follow the instructions below for your operating system.
Windows (WSL)¶
WSL provides a full Linux environment on Windows and is recommended for this workshop.
Prerequisites:
Windows 10 version 2004 or higher, or Windows 11
Administrator access
Installation steps:
Install WSL:
Open PowerShell or Command Prompt as Administrator
Run:
wsl --installRestart your computer when prompted
After restart, set up your Linux distribution:
A terminal window will open automatically
Create a username and password when prompted
This will be your Linux user account (separate from your Windows account)
Install Git in WSL:
Open your WSL terminal (Ubuntu, or your chosen distribution)
Update package lists:
sudo apt updateInstall Git:
sudo apt install git
Verify the installation:
git --versionYou should see a version number (e.g.,
git version 2.43.0).Configure Git (see Post-installation section below)
Accessing your Windows files from WSL:
Windows drives are mounted at
/mnt/(e.g.,C:\is/mnt/c/)Your Windows user directory:
/mnt/c/Users/YourUsername/You can navigate between Windows and Linux file systems from within WSL
Opening WSL:
Type
wslin Windows Start menu, orType
ubuntu(or your distribution name) in Start menu, orOpen from VS Code: File → Open Folder → Select a folder → Choose “Open in WSL”
macOS¶
Option 1: Install via Xcode Command Line Tools (simplest)¶
Open Terminal (Applications → Utilities → Terminal).
Run:
git --versionIf Git is not installed, macOS will prompt you to install the Command Line Developer Tools.
Click Install and follow the prompts.
After installation completes, verify:
git --version
Option 2: Install using Homebrew (recommended for developers)¶
If you already use Homebrew:
Install Git:
brew install gitVerify the installation:
git --version
Linux¶
Option 1: Installing Git on Ubuntu / Debian¶
Open a terminal.
Update your package index:
sudo apt updateInstall Git:
sudo apt install gitVerify the installation:
git --versionYou should see a version number (for example,
git version 2.43.0).
Option 2: Installing Git on Fedora / RHEL / Rocky / AlmaLinux¶
Open a terminal.
Install Git:
sudo dnf install gitVerify the installation:
git --version
Option 3: Installing Git on Arch Linux / Manjaro¶
Open a terminal.
Install Git:
sudo pacman -S gitVerify the installation:
git --version
Option 4: Installing Git on openSUSE¶
Open a terminal.
Install Git:
sudo zypper install gitVerify the installation:
git --version
D. Post-installation (All Platforms)¶
After installing Git, configure your name and email (required for commits):
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"You can confirm your settings with:
git config --global --listE. Troubleshooting¶
If
git --versiondoes not work:Restart your terminal and try again.
On Windows, ensure you are using WSL.
If using WSL, make sure you’re running commands in the WSL terminal, not PowerShell or Command Prompt.
If problems persist, see: https://
git -scm .com /book /en /v2 /Getting -Started -Installing -Git
WSL-specific troubleshooting:
If
wsl --installfails, you may need to enable WSL features manually:Open “Turn Windows features on or off”
Enable “Windows Subsystem for Linux” and “Virtual Machine Platform”
Restart and try
wsl --installagain
If you can’t access Windows files from WSL, check that you’re using the correct path format (
/mnt/c/instead ofC:\)For more WSL help, see: https://
learn .microsoft .com /en -us /windows /wsl/
Configure SSH Authentication with GitHub¶
This section shows how to create and configure an SSH key so you can push commits from your local machine to GitHub.
Step 1. Install and/or enable SSH on your laptop¶
Windows (WSL)¶
WSL provides a Linux-like environment that was installed in the section “Installing Git on Windows”
Open your WSL distro (e.g., Ubuntu), then:
sudo apt update
sudo apt install git openssh-clientmacOS¶
Most macOS systems include Git and SSH via Apple’s command line tools.
Verify:
git --version
ssh -VIf needed:
xcode-select --installLinux (Ubuntu/Debian)¶
sudo apt update
sudo apt install git openssh-clientStep. 2 Generate an SSH key¶
In a terminal, run the following command to create the key:
ssh-keygen -t ed25519 -C "your_email@example.com"Press Enter to accept the default file location
Optionally set a passphrase
Step 3. Set the key’s permissions¶
Set secure file permissions on your private key. SSH requires strict permissions on your key files and .ssh directory. Run the following commands:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
chmod 644 ~/.ssh/id_ed25519.pubWhat these do:
700 ~/.ssh→ Only you can access your SSH directory600 id_ed25519→ Private key is readable only by you644 id_ed25519.pub→ Public key can be read but not modified by others
Step. 4 Start the SSH agent and add your key¶
Run the following commands to start the SSH agent process and then add your key to the process so you can authenticate with SSH.
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519Step. 5 Add your public key to GitHub¶
Copy your public key content by running the following command:
cat ~/.ssh/id_ed25519.pubCopy the key content from the output of the command, it should look something like:
ssh-ed25519 AAAAAAAAAAfsjkldfaieaflkfnc4598035jnsdfksdlcnswef03248slffjklsfjklsd90 your_email@example.com
Then in GitHub:
Go to GitHub → Settings
Click SSH and GPG keys
Click New SSH key
Paste the key
Click Add SSH key
Step. 6 Test your SSH connection¶
ssh -T git@github.comExpected output looks like:
Hi USERNAME! You've successfully authenticated...Step. 7 Make sure your repo remote uses SSH (optional)¶
When cloning, use the SSH URL:
git clone git@github.com:USERNAME/REPO.gitIf you already cloned with HTTPS, switch the origin remote:
git remote -v
git remote set-url origin git@github.com:USERNAME/REPO.git
git remote -v