Install Git on Ubuntu

Update the Packages
Before installing Git, update your package list to get the latest version from the repositories.
sudo apt update
Step 2: Install Git
Once the package list is updated, you can install Git using the following command.
sudo apt install git
When prompted, confirm the installation by typing Y
and pressing Enter.
Verify the Installation
After Git is installed, verify it by checking the installed version.
git --version
If Git is installed correctly, the terminal will output the installed version of Git, like this.
git version 2.34.1
Configure Git
Once Git is installed, it’s recommended to configure your user information for version control.
Set your username
git config --global user.name "Your Name"
Set your email.
git config --global user.email "your.email@example.com"
Check Git Configuration
You can verify your Git configuration by running.
git config --list
This will show the configuration details, including your username and email.
Subscribe to my newsletter
Read articles from Ankita Lunawat directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Ankita Lunawat
Ankita Lunawat
Hi there! I'm a passionate AWS DevOps Engineer with 2+ years of experience in building and managing scalable, reliable, and secure cloud infrastructure. I'm excited to share my knowledge and insights through this blog. Here, you'll find articles on: AWS Services: Deep dives into core AWS services like EC2, S3, Lambda, and more. DevOps Practices: Best practices for CI/CD, infrastructure as code, and automation. Security: Tips and tricks for securing your AWS environments. Serverless Computing: Building and deploying serverless applications. Troubleshooting: Common issues and solutions in AWS. I'm always eager to learn and grow, and I hope this blog can be a valuable resource for fellow DevOps enthusiasts. Feel free to connect with me on [LinkedIn/Twitter] or leave a comment below!