Installing Git
Windows Installation
The easiest way to install Git on Windows is by using the Git for Windows installer. Download here.
To verify Git has been successfully installed, open the Windows command prompt and run:
git --versionMacOS Installation
I recommend installing Git using the Xcode Command Line Tools program provided by Apple. Xcode is Apple's integrated development environment that provides tools to develop software for Apple platforms; however, if you don't plan on doing app development, downloading the much smaller Xcode Command Line Tools application installs many helpful developer tools, such as Git.
To install Git, open the macOS Terminal application (found under /Applications/Utilities/Terminal), type the following line, and hit enter:
xcode-select --installA dialog box will appear asking you to confirm installation of command line developer tools. Click "Install." Once you see a confirmation message (the download may take 10 minutes or more), run the following command in your terminal to verify the installation:
xcode-select -vYou should see no errors and the current version of xcode-select should be printed. After this, verify Git was installed by typing:
git -vYou should see no errors and a message similar to the following: git version 2.39.2 (Apple Git-143)
If you run into trouble with any of these steps, try installing Git using another method such as Homebrew. Further installation methods can be found here.
Linux Installation
Installation instructions vary by the type of Linux distribution you are running. If you are running Ubuntu or Debian, apt will likely be your package manager of choice, or other distributions yum or dnf may be used.
Ubuntu or Debian (Raspberry Pi)
Use the following command to update your local package index and install Git:
sudo apt update && sudo apt install gitVerify Git has been installed correctly by running:
git --versionThe output should be something like this: git version 2.3
Other Linux Distros
If you are running a Linux distribution other than Ubuntu or Debian, rather than listing each install command individually, check this page for installation commands for other Linux distros.
Troubleshooting
The installation instructions in this lesson are far from unique. Many other high-quality resources document how to install Git, including the official Git documentation and GitHub's guide. If you're having trouble with anything in this lesson, take a look at one of those other resources.