Git is one of the most widely used open-source version control systems. It allows you to manage code, collaborate with other developers, and track changes to your files safely and efficiently. Below is a detailed, knowledge-base-ready guide based on the official Git documentation explaining how to install and configure Git across different operating systems.
Git is a distributed version control system (DVCS). Unlike centralized systems, each developer has a full copy of the repository — including all history and branches. This makes it fast, secure, and reliable for projects of any size.
Most Linux distributions include Git in their default repositories. You can install it directly using your package manager.
sudo apt update sudo apt install git
Verify that the installation completed successfully:
git --version
To install the latest available Git version, add the official Git PPA repository:
sudo add-apt-repository ppa:git-core/ppa sudo apt update sudo apt install git
sudo dnf install git
On CentOS 8 and later, use dnf instead of yum:
sudo dnf install git
For older releases (CentOS 7):
sudo yum install git
sudo pacman -Sy git
There are several ways to install Git on macOS.
Run the following command in the Terminal:
xcode-select --install
A dialog window will appear; follow the prompts to complete the installation. Once done, Git will be available system-wide.
If you use Homebrew, simply run:
brew install git
Download the official macOS installer from git-scm.com/download/mac and follow the on-screen instructions.
The easiest way to install Git on Windows is through the Git for Windows installer, which includes both command-line and graphical tools.
Go to git-scm.com/download/win and download the latest version for Windows.
You can generally keep the default settings unless you have specific requirements. The installer will include:
After installation, open Git Bash and verify it’s installed correctly:
git --version
If you see a version number (e.g. git version 2.45.1.windows.1), your setup was successful.
After installing Git, configure your name and email address. These details are included in your commits and identify you as the author.
git config --global user.name "Your Name" git config --global user.email "you@example.com"
To verify your settings:
git config --list
You can also set your preferred text editor (for example, Nano or Vim):
git config --global core.editor "nano"
Enable colored output for better readability in the terminal:
git config --global color.ui auto
Create a test directory and initialize a new repository to confirm Git works correctly:
mkdir git-test cd git-test git init
If you see the message:
"Initialized empty Git repository in /home/user/git-test/.git/"
then Git is installed and working properly.
git config --list.You have now successfully installed and configured Git. You can start creating repositories, making commits, and collaborating with other developers using platforms such as GitHub or GitLab. Git is an essential tool for every development workflow.
Contact our experts, they will be happy to help!
Contact us