Install Git

Before we start, we need Git on our computer. The installation is simple and takes only a few minutes. First check if Git is already installed, because many Mac and Linux computers already have it.

Check if Git is already installed

Open the terminal (Command Prompt, PowerShell or Git Bash on Windows) and type this command:

Terminal output

$ git –version
git version 2.49.0

If you see a version number, Git is installed. Your version can be different from the one above, and that is fine. If you get an error like “command not found”, follow the steps below.

Install Git on Windows

  • Go to the official website git-scm.com and download the installer for Windows.
  • Run the installer. You can keep the default options on each screen.
  • When it finishes, open Git Bash from the Start menu. It is a terminal where Git commands work like on Linux.

You can also install it from the command line with winget:

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

Install Git on macOS

The easiest way is Homebrew:

brew install git

Another way is to run git --version in the terminal. If Git is not installed, macOS asks you to install the Xcode Command Line Tools, which include Git.

Install Git on Linux

# Ubuntu / Debian
sudo apt update
sudo apt install git

# Fedora
sudo dnf install git

# Arch Linux
sudo pacman -S git

Which tools to use with Git?

You can use Git from the terminal, and we will do the same in this tutorial, because the commands are same everywhere. There are also apps with buttons like GitHub Desktop, Sourcetree and the Git support inside VS Code. They are good, but understanding the commands first makes any app easy.

Note: After the install, the next step is to tell Git your name and email. See Git Configuration.

Congratulations! Chapter Finished. Learn more about the similar topics:
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.