Git is one of the most popular version control or source code management system. It provides facility to track changes in source code for many open source and commercial projects. Version control systems help you share and collaborate on software development projects. In this tutorial we’ll explain how to install Git on Ubuntu 22.04 Jammy Jellyfish.
How to Install Git on Ubuntu 22.04
By default Ubuntu repository includes Git packages. It’s quite simple and straightforward to install Git using apt package manager on Ubuntu.
Step 1 – Update Default Packages
Before process ahead, you need to update your system packages. Make sure you are logged in as a root or user with sudo privileges.
sudo apt update && upgrade -y
Step 2 – Installing Git
Run the below command to install Git:
sudo apt install git -y
Step 3 – Verify Installation
To verify the installation use the below given command which will show the Git version:
git --version
git version 2.34.1
Currently, in Ubuntu repositories latest git version is 2.34.1
. It may vary while you are installing.
Step 4 – Configure Git
At this stage, Git installed successfully and to prevent warnings, you should configure it by setting up email address and username:
git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
Don’t forget to replace with your real name and email address.
You can check entered details by typing:
git config --list
user.name=Your Name user.email=youremail@example.com
These settings are stored at ~/.gitconfig
file and you can see content as below:
You can make other git configuration changes by using git config command or you can use text editor to make changes to ~/.gitconfig
file manually.
Conclusion
In this guide, we show you how to install Git on Ubuntu 22.04 Jammy Jellyfish. You can get more details about use of Git from Pro Git book.
Feel free to comment below, if any question or suggestion.