Table of Contents
What you will read?
Git is the most widely used version control system for developers and system administrators. On Debian-based systems like Debian 12 (Bookworm), Debian 11 (Bullseye), and Debian 10 (Buster), installing Git is straightforward and requires only a few steps
Step 1: Update the System Packages
Before installing Git, update the package index to ensure you are installing the latest version available in Debian’s repositories:
sudo apt update
sudo apt upgrade -y
Step 2: Install Git
Use the default Debian repositories to install Git. This works for Debian 12, 11, and 10:
sudo apt install git -y
Verify the installation with:
git --version
This command will display the installed Git version.
Step 3: Configure Git User Information
Git requires user details for commits. Configure your name and email address globally on your system:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
You can confirm your configuration with:
git config --list
Step 4: Test Git Installation
To confirm that Git is working properly, create a new directory and initialize a repository:
mkdir test-git
cd test-git
git init
If you see the message “Initialized empty Git repository”, Git is successfully installed and ready to use.
