Git Version Control System (VCS) works like a database, where you can back up your project process in snapshots. The progress of your project will be tracked with the help of git. Presently, Git VCS is a popular platform for teamwork and storing different versions of your project. The current version of git is 2.34.1 that includes many useful features to save your time without losing your data.
Git is an open-source and cross-platform utility which is favorable for organizations and the individuals to keep track of their projects on all platforms. All the members of a team remain in touch with the changes performed by any stakeholder.
This article serves the following learning outcomes:
- How to install Git on Ubuntu 22.04
- How to configure Git on Ubuntu 22.04
How to install and configure Git on Ubuntu 22.04
Git provides a “free-hand” working mechanism for every team member to play his part in the project. Git manages and integrates all the changes instantly. Git will merge all your previous versions of your task and will make one final document at the end.
This section refers to the installation and configuration of Git on Ubuntu 22.04.
Installation of Git on Ubuntu 22.04
Git manages and integrates all the changes instantly. Here, we will show you how SSH can be installed on Ubuntu 22.04.
The following steps will guide you to install Git on Ubuntu 22.04.
Step 1: Update System Package
Run the update command in Ubuntu terminal (Ctrl+Alt+T) to update your system cache.
$ sudo apt update
Run the following command to check the availability of Git on your system:
$ git --version
You will notice that ‘git’ is not found and at the same time you will see the command for git installation.
Step 2: Install Git
To install the git repository, run the following command in your terminal. Type ‘y’ to continue the process.
$ sudo apt install git
It is observed from the output that Git has been installed successfully on Ubuntu 22.04.
Step 3: Verify Git Installation
To verify the installation, make use of the below-mentioned command:
$ git --version
Git 2.34.1 is the version that is installed on your system.
How to configure Git on Ubuntu 22.04
After the installation, it is recommended to carry out the necessary configuration of Git on Ubuntu 22.04. Let’s refer to the following steps to configure Git on Ubuntu 22.04.
Step 1: Check the Configuration
First of all, check your list of git configuration with a simple command:
Note: Do not forget two dashes (—) before the list.
$ git config --list
The above image did not return any output which states that you have not configured your git repository yet.
Step 2: Add a user and email
Add user name for every repository with –global:
$ git config --global user.name "itslinux"
Add user email for every repository with –global:
$ git config --global user.email "[email protected]"
Note: user-email must be a valid email because git will send verification codes on the said mail.
After doing so, you can observe the changes in the Git configuration list as follows:
$ git config --list
Step 3: Git Initialization
You can initialize an existing project folder or make a new directory to initialize Git inside it. create a new directory with mkdir command.
$ mkdir proj1
Get inside that folder by issuing the following command:
$ cd proj1
The following command will initialize the Git repository in the “proj1” directory:
$ git init
The output shows that the Git repository has been initialized in the “proj1” directory.
Let’s check the status of Git inside the “proj1” directory.
$ git status
The command shows that the Git is working inside the “proj1” and there are no commits encountered yet.
Bonus Tip: If you are new to the git version control system, you should see these 30 essential git commands or run the below command to see the common options supported by git command on Ubuntu.
$ git --help
The Git has been installed and configured on Ubuntu 22.04.
How to uninstall Git from Ubuntu 22.04
To uninstall Git from an Ubuntu machine, the following command is used:
$ sudo apt remove git
By executing the command given above, Git will be uninstalled instantly.
Git can be installed from the official repository of Ubuntu 22.04 by using the apt command. It can be configured by adding a user, email for every repository (globally) or for a single repository as well.
This article provides a detailed demonstration of installation and configuration of Git on Ubuntu 22.04. Git is an important utility to track the changes/modification in any project(s). Therefore, it is an important utility while working in a distributed environment.
TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY