Git is a distributed version control system used to track changes in source code. To start using Git, you must install it on your operating system.
After installation, Git is accessed through the command line. The git --version command confirms the installed version.
Download Git from the official website and follow the installer steps.
// Check Git version on Windows
git --version
Git can be installed using Homebrew.
// Install Homebrew on macOS
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
// Install Git using Homebrew
brew install git
Use your distribution’s package manager.
// Update package list on Ubuntu/Debian
sudo apt-get update
// Install Git on Ubuntu/Debian
sudo apt-get install git
// Install Git on Red Hat/Fedora
sudo yum install git
Running git --version prints the installed Git version, confirming a successful installation.
git --versiongit init and git status