Git fundamentals
Install Git
Install the Git command-line tool and verify that your terminal can run it.
8 minute lesson
Git is a command-line program, so installing it means getting the git command working in your terminal. Install Git with the package recommended for your operating system. The official Git website at git-scm.com lists current installers and package-manager options.
On macOS, the quickest route is Apple’s command line tools, which include Git:
xcode-select --install
If you use Homebrew, brew install git gives you a more recent version than the Apple one. On Windows, download the Git for Windows installer from the official site; it also provides Git Bash, a terminal where the commands in this course work as written. On Linux, use your distribution’s package manager, for example sudo apt install git on Debian and Ubuntu.
Whichever route you took, check the command from the terminal:
git --version
You should see output similar to:
git version 2.50.1
The exact number will change. What matters is that your shell finds one Git installation. Version differences rarely matter for this course; anything from recent years covers everything we use.
If you see command not found, close and reopen the terminal first. An installer may have changed your shell’s command path, and open terminals keep the old one. If the problem remains, check the installation instructions for your operating system instead of installing a second copy at random. Two competing installations cause the confusing situation where the version you update is not the version your shell runs.
You can also find which executable your shell selected:
command -v git
This prints a path such as /usr/bin/git or /opt/homebrew/bin/git, telling you exactly which installation answers the git command.
Exercise: record the version and executable path. This information is useful when two computers behave differently.
Lesson completed