Git And Terminal Setup

Install Git, choose the expected terminal for your operating system, and verify both before continuing.

Objectives

  • Distinguish Git from the terminal used to run it
  • Install or confirm Git on Windows, macOS, or Linux
  • Open the expected terminal for later examples
  • Verify that Git and basic shell commands are available

Git And The Terminal Are Different Tools

  • A terminal is the window where you type commands
  • A shell reads those commands and runs programs
  • Git is a program that records changes to files
  • Windows users will use Git Bash for the shared Bash-style commands
  • macOS and Linux users can use their built-in terminal applications

Windows: Install Git For Windows

  1. Download Git for Windows
  2. Run the installer
  3. Follow the selected settings in the slides below
  4. Finish the installation and open Git Bash from the Start menu
  • Git for Windows installs both Git and Git Bash
  • Windows Terminal and PowerShell remain available, but Git Bash is the expected shell for these examples
  • The screenshots show Git for Windows 2.55.0; later versions may adjust wording or order
  • See the slides below for the installer choices that affect later work

Windows Installer: Components

Git for Windows 2.55 component selection screen

  • Keep the selections shown
  • Git Bash Here opens Git Bash directly inside a folder
  • The Windows Terminal profile makes Git Bash available there as an optional profile
  • Continue with Next

Windows Installer: Default Editor

Git for Windows default editor screen with Nano selected

  • Choose Use the Nano editor by default
  • Nano is a beginner-friendly terminal editor and is easier to exit than Vim
  • Git may open it when a command needs a commit or merge message
  • VS Code will be configured separately in a later presentation

Windows Installer: Initial Branch

Git for Windows initial branch configuration screen

  • Select Override the default branch name for new repositories
  • Enter the branch name main
  • This affects repositories created with git init, not existing repositories
  • Later examples will identify other branches when they are needed

Windows Installer: Command-Line PATH

Git for Windows PATH screen with command-line and third-party software selected

  • Select Git from the command line and also from 3rd-party software
  • Git should be available from Git Bash and other applications
  • This also lets applications such as VS Code find Git
  • Do not select the option that adds Unix tools to Command Prompt because it can override Windows tools
  • Reopen terminal windows after installation so they receive the updated PATH

Windows Installer: HTTPS

Git for Windows HTTPS transport screen with OpenSSL selected

  • Keep Use the OpenSSL library selected
  • This is the normal cross-platform certificate option for Git for Windows
  • The later GitHub workflow uses SSH, but Git and related tools may still make HTTPS requests

Windows Installer: Line Endings

Git for Windows line-ending screen with Windows checkout and Unix commit selected

  • Keep Checkout Windows-style, commit Unix-style line endings selected
  • Working files can use Windows line endings while committed text is normalized to Unix-style line endings
  • A repository's .gitattributes file can provide more specific rules later

Windows Installer: Terminal Emulator

Git for Windows terminal emulator screen with MinTTY selected

  • Keep Use MinTTY selected
  • MinTTY is the normal Git Bash terminal window
  • Later Windows examples assume this Git Bash environment

Windows Installer: Pull Behavior

Git for Windows pull behavior screen with Merge selected

  • Keep Merge selected
  • git pull will fetch remote changes and merge them into the current branch when necessary
  • A later presentation demonstrates pulls, merges, and merge conflicts

Windows Installer: Credential Helper

Git for Windows credential helper screen with None selected

  • Select None for this SSH-based GitHub workflow
  • Git Credential Manager handles HTTP(S) authentication and is not used for SSH
  • Leaving Git Credential Manager enabled would not break SSH, but it is unnecessary for this course path

Windows Installer: Extra Options

Git for Windows extra options screen with file system caching enabled and symbolic links disabled

  • Keep Enable file system caching selected
  • Leave Enable symbolic links cleared because the course repositories do not require them
  • Symbolic links need additional Windows support and should be enabled only when a project specifically requires them
  • Finish the installer

Open The Expected Windows Shell

  • Preferred: open Git Bash from the Start menu
  • Folder shortcut: right-click a folder and choose Git Bash Here when that component is installed
  • Windows Terminal can use a Git Bash profile when it is configured correctly
  • Typing bash in another Windows shell can start Git Bash when Git's Bash executable is the one found on PATH
  • This is not a reliable shortcut because another installed Bash program may be found first
  • When WSL is installed, bash may enter WSL and use Linux paths such as /mnt/c instead of Git Bash paths such as /c

macOS: Use Terminal

  • Open Terminal from Applications > Utilities
  • Run git --version to check whether Git is available
  • If macOS offers to install Command Line Tools, complete that installation
  • The built-in Terminal is sufficient for every shared command
  • See the slides below for manual installation and an optional terminal alternative

macOS: Install Git When Missing

macos-install-git-when-m-01.sh
Loading code...
  • Use the command when git --version reports that Git is unavailable
  • Complete the Apple installer, then open a new Terminal window
  • See the official Git installation options for macOS when the installer does not appear

macOS: Optional Terminal Alternative

  • Optional iTerm2 adds features such as split panes, profiles, and additional customization
  • The application is optional and does not change Git commands
  • Start with the built-in Terminal unless you already prefer another terminal

Linux: Use The Installed Terminal

  • Open the terminal application included with the distribution
  • Run git --version to check whether Git is available
  • Install Git with the distribution's package manager when it is missing
  • The installed terminal is sufficient for every shared command
  • See the slides below for installation examples and optional alternatives

Linux: Install Git When Missing

Ubuntu or Debian:

linux-install-git-when-m-02.sh
Loading code...
  • Other distributions use different package managers
  • See the official Git installation options for Linux
  • Open a new terminal after installation when the current one cannot find Git

Linux: Optional Terminal Alternatives

  • GNOME Terminal, Konsole, Tilix, and other terminal applications can run the same Git commands
  • Features and availability depend on the desktop environment and distribution
  • Use the installed terminal when optional setup adds friction

Verify The Setup

verify-the-setup-03.sh
Loading code...
  • git --version should print an installed Git version
  • pwd should print the terminal's current directory
  • Windows users should run both commands in Git Bash
  • Continue only after neither command reports "command not found"

Common Troubleshooting

ProblemSolution
git: command not foundInstall Git, close the terminal, then open a new terminal window
Git works in one terminal but not anotherRestart the intended terminal after installing Git
Windows opens PowerShell or Command PromptOpen Git Bash from the Start menu or select its configured terminal profile
Running bash opens WSLExit that shell and open Git Bash directly so Windows paths use the expected format
git --version works but pwd does notConfirm that Windows is using Git Bash

Knowledge Check

Questions

  1. What does Git do, and what does the shell do?
  2. Which terminal should Windows users use for these lessons?
  3. Which terminal should macOS and Linux users use?
  4. How do you make a program accessible from the terminal on Windows, macOS, and Linux?
  5. What is the purpose of running git --version and pwd in this lesson?

Answers

  1. Git tracks changes and file history; the shell reads commands and runs programs
  2. Windows users should use Git Bash; not PowerShell or Command Prompt
  3. macOS and Linux users can use their built-in terminal applications
  4. Installers on Windows, macOS, and Linux should add the program to PATH. If needed, add its folder manually; on macOS or Linux, update ~/.zshrc or ~/.bashrc
  5. git --version verifies that Git is installed and accessible; pwd verifies that the shell can report the current directory

Use Next to reveal each answer

Key Terms And Further Learning

  • Git: A tool that records changes to files and their history.
  • Shell: The program that reads commands in a terminal.
  • PATH: The locations the shell searches for commands such as git.

Further Learning:

Summary

  • Install Git before beginning the CLI and GitHub workflows
  • Use Git Bash on Windows and the built-in terminal on macOS or Linux
  • Keep the Windows installer choices aligned with main, command-line access, merge-based pulls, and the course's SSH workflow
  • Treat alternative terminal applications as optional
  • Verify the setup with git --version and pwd

Next presentation: CLI Foundations