Lesson 6 of 60 – Installing Git
10%

Installing Git

Before using Git commands, you need to install Git on your computer. Git is available for major operating systems such as Windows, macOS and Linux.

Note: After installing Git, you can verify the installation by running git --version in a terminal.

1. What is Git Installation?

Git installation means installing the Git software on your computer so that you can use Git commands to manage your projects.

After installation, Git can be used from a terminal such as Git Bash, Command Prompt or another supported shell.

2. Supported Operating Systems

Git can be installed on several operating systems, including:

  • Windows
  • macOS
  • Linux

The installation process differs slightly depending on the operating system.

3. Installing Git on Windows

Windows users can install Git using the official Git for Windows installer.

The installer provides Git along with tools such as Git Bash.

4. Downloading Git for Windows

To install Git on Windows, download the Git for Windows installer from the official Git website.

Choose the installer appropriate for your Windows system and processor architecture.

5. Starting the Windows Installer

After downloading the installer, open the installer file. The Git Setup window will guide you through the installation process.

Follow the setup instructions shown on the screen.

6. Choosing the Installation Folder

The installer asks where Git should be installed. For most beginners, the default installation folder is suitable.

You can continue with the default location unless you have a specific reason to change it.

7. Selecting Components

The Git installer provides options for selecting components and features.

Beginners can generally use the recommended defaults and continue through the setup wizard.

8. Git Bash

Git for Windows includes Git Bash, a terminal environment that allows you to run Git commands.

git --version

Git Bash can also be used for many common command-line operations.

9. Git Command Line

Git commands can be executed from a command-line interface. For example:

git status

The command-line interface is useful for learning and automating Git workflows.

10. Completing Git Installation

Continue through the installer until the installation is complete. After the installation finishes, open a terminal and verify Git.

git --version

11. Checking the Git Version

The git --version command displays the installed Git version.

git --version

A successful installation should display a Git version number.

12. Example Version Output

The exact version depends on the Git release installed on your computer. An example format is:

git version 2.x.x

The version number may be different on your system.

13. Installing Git on macOS

Git can be installed and used on macOS. Depending on the system configuration, Git may already be available or can be installed using an appropriate Git installation method.

After installation, verify it with:

git --version

14. Installing Git on Linux

Git can be installed using the package manager provided by your Linux distribution.

For example, Debian-based systems commonly use:

sudo apt install git

The exact command can vary between Linux distributions.

15. Verifying Git on Linux

After installing Git, verify the installation using:

git --version

If Git is installed correctly, the terminal will display the installed version.

16. Git Installation and PATH

The system's PATH helps the terminal find executable programs.

A properly configured Git installation should allow you to run the git command from a terminal.

git --version

17. Git Executable

The Git executable is the program that runs Git commands. When you type:

git status

the operating system finds and executes the Git program.

18. Opening Git Bash

On Windows, after installing Git, you can open Git Bash from the Start menu or from a project folder where the option is available.

Then you can execute Git commands directly:

git --version
git status

19. Opening a Terminal

Git commands can also be used from other terminal applications, provided Git is correctly installed and available through the system PATH.

git --version

20. Git Installation Test

A simple installation test is to run:

git --version

You can then test a basic Git command:

git help

If the commands execute successfully, Git is available from the terminal.

21. Creating a Test Folder

After installing Git, create a folder for practicing Git commands. For example:

mkdir git-practice
cd git-practice

You can initialize this folder as a Git repository in the next step.

22. Testing Git with a Repository

Inside your practice folder, initialize a Git repository:

git init

Git will create the repository metadata for the project.

23. Checking Repository Status

After initializing the repository, check its status:

git status

This confirms that Git can operate in the current project directory.

24. Common Installation Problems

Sometimes the terminal may display an error such as:

'git' is not recognized as an internal or external command

This generally means Git is not installed correctly or the Git executable is not available through the system PATH.

25. Checking PATH Problems

If the git command is not recognized, check whether Git was installed correctly and whether its executable directory is available through the PATH.

On Windows, restarting the terminal after installation can also be necessary for newly updated environment settings to become available.

26. Reinstalling Git

If Git installation is incomplete or damaged, reinstalling Git using the appropriate installer can help resolve installation problems.

After reinstalling, verify it again:

git --version

27. Updating Git

Git is actively maintained and new releases are published over time. Keeping Git reasonably up to date can provide newer features and bug fixes.

The update method depends on your operating system and installation method.

28. Git Installation Checklist

  • Download Git using an appropriate installation method.
  • Complete the installation.
  • Open a terminal.
  • Run git --version.
  • Confirm that a Git version is displayed.
  • Create a practice folder.
  • Run git init.
  • Run git status.

29. Basic Installation Test

After installing Git, you can perform this simple test:

git --version

mkdir git-practice
cd git-practice

git init
git status

This confirms that Git is available and can initialize a repository.

30. Ready to Learn Git

Once Git is installed and verified, you are ready to learn Git configuration, repositories, commits, branches and other commands.

In the next lesson, we will learn how to configure Git with your name and email address.

📌 Key Points

  • Git can be installed on Windows, macOS and Linux.
  • Git for Windows includes Git Bash.
  • git --version verifies the Git installation.
  • Git commands can be executed from a terminal.
  • Git should be available through the system PATH.
  • git init can be used to test repository creation.
  • git status can be used to check a repository.
  • Installation problems may be related to an incomplete installation or PATH configuration.
  • Git can be updated as new versions become available.
  • After installation, you are ready to configure Git.

🧠 Quick Quiz

Question: Which command is used to check whether Git is installed?