← Back to Git Course | Chapter 1: Introduction & Setup | Lesson 3 of 7

Git Installation & Setup

Installing Git is like putting a new app on your device and telling it who you are. You download it once and then it is ready for any project.

Installing on Windows

On Windows, download the official installer from git-scm.com; it bundles Git Bash, a Unix-style terminal emulator, so you get the same command syntax used in every Git tutorial and by developers on macOS or Linux.

Example: Installing on Windows

bash
winget install --id Git.Git -e --source winget

Installing on macOS

On macOS, Git usually ships through the Xcode Command Line Tools rather than a separate installer -- open Terminal, run any git command, and macOS will prompt you to install the tools automatically if they're missing.

Example: Installing on macOS

bash
xcode-select --install

Installing on Linux

On Linux, Git comes from your distribution's package manager, so the exact command depends on your flavor: apt install git on Debian/Ubuntu, yum install git (or dnf) on Red Hat/CentOS/Fedora.

Example: Installing on Linux

bash
sudo apt install git
sudo yum install git

Opening Git Bash or Terminal

Once installed, all Git commands are typed into a terminal-style interface -- Git Bash on Windows, or the built-in Terminal app on macOS and Linux -- since Git itself has no graphical interface of its own by default.

Example: Opening Git Bash or Terminal

bash
git help

Initial Verification

After installing, it's worth running a quick version check to confirm the Git binary is reachable from your terminal; catching a broken PATH now is much less confusing than debugging a mysterious 'command not found' error later.

Example: Initial Verification

bash
git --version
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
Common Mistakes
  1. Installing Git and then running git in a terminal that was already open, getting command not found because the terminal needs to be restarted to see the new PATH.
  2. Skipping the check with git --version after installing, so a failed or partial install goes unnoticed until the first command fails.
  3. Installing a different package with a similar name, such as apt install git-all when only git is needed, pulling in many extra tools.
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.