How to solve the Error "bash: git: command not found" on Deepin OS 20.7 or any other Debian-based Linux distribution?


Git

Git is a distributed version control system (DVCS) used for tracking changes in source code during software development.

It is a powerful and widely used tool in the field of software development and is essential for managing and collaborating on code with multiple team members.

Git is commonly used in conjunction with online platforms like GitLab, GitHub, and Bitbucket, which provide additional collaboration features, issue tracking, continuous integration, and more.


Error

bash: git: command not found

Snapshot


Brief explanation

The error message "bash: git: command not found" indicates that Git is not installed on your system.


Check installation

Let's check if git is installed.


Through the version

git --version

This should display the installed Git version, confirming that Git is now available on your system. if you don't see, it's because Git is not installed on your system.


Locate the executable path

The which command in Linux is used to locate and display the path to an executable file associated with a given command.

It helps you determine the location of the executable that would be run if you were to execute a particular command in your shell.

which git

if there's no output, it's because Git is not installed on your system.


Update the package manager

sudo apt-get update

Install Git

sudo apt-get install git -y

Output


Check installation

Through the version

git --version

This should display the installed Git version.


Through the executable path

which git

This should display the installed Git version.