How to Install and Configure Git on Ubuntu 20.04 (Tutorial). It is worth knowing that the most well known version control system in the world today is Git. So many software projects count on Git for version control.
In this post, we introduce Git, its features and after that we show you how to install and configure Git on Ubuntu 20.04.
Currently, GIT is the prominent and widely used control system. Developed as an open source project in 2005, it is a mature and actively maintained environment. Developers usually rely on the GIT version to control and develop several commercial and non commercial projects. DevOps developers consider GIT as a valuable resource.
Truly designed for its speed and simplicity. Moreover Git is fully distributed and has great support that aids parallel development, including supporting hundreds of parallel branches.
GIT is a main Version Control System today. Moreover, this open source software is easy to handle and perform. What is more, it allows you to work together as a team using the same profiles. Following the features GIT provides to its users:
Distributed System
All in all, Git enables users to perform work on projects worldwide. Altogether, it keeps a central repository accessed by multiple remotecollaborators that use a Version Control System. Central Servers sometimes have issues like Data Loss or Data Connectivity. Thanks to GIT, it mirrors the entire repository on every version’s snapshot to tackle this problem. Therefore, if the central server crashes, users acquire copies of repositories from the users who have downloaded the latest snapshot of the project.
Non Linear Development
Users from all across the world can perform operations on the project remotely with the help of GIT. With this tool, users pick up any part of the project and perform the necessary operation, and then further update the operation. Importantly, it is possible only because of the Non Linear development behaviour of the GIT.
Branching
With the help of GIT, users work on a line that runs parallel to the main project files, called branches. With these branches, users make changes to the project without affecting the original version. The version’s master branch constitutes the production quality code. Therefore, users have the availability to test and work on any new features on the branches and further combines them with the master branch.
Compatibility
Certainly, GIT is compatible with every Operating System used these days. Concurrently, it accesses the remote repositories directly that SVNs create. So, users that do not use GIT in the first place can switch to GIT without undergoing the process of copying their files from the repositories of other VCSs into GIT VCS.
Compared to other Version Control Systems, GIT performs very strongly and reliably. Users commit to new code changes effortlessly and compare and merged with version branches. Consequently, it also optimizes code to perform better. Why? because Git focuses on the content of the file itself rather than the filename as it determines the storage and file type history. The Git repository file format uses several combinations of delta encoding and compression techniques to store metadata and directory content.
Security
Equally, GIT is designed specially to maintain the integrity of source code. The contents of files and the relationship between files and directories, tags, makes, versions, etc., are cryptographically secure using an algorithm called SHA1 that protects the code and changes history from accidental and malicious damage. You can be sure that you have a good history of your source code in Git.
Flexibility
Evidently, GIT offers flexibility to support several kinds of non linear development workflows and its efficiency in handling both small scale and large scale projects and protocols. Specially designed to support tagging activities in domains and save any activity that a user performs as part of the “change” history. Not all VCS support this feature.
Wide Acceptance
Git offers the kind of functionality, features, security, and flexibility that most developers and teams need to develop their projects. Compared to other VCSs, Git is the most widely accepted system due to its usability and universally accepted performance standards.
It is time for the main part of this article about how to Install and Configure Git on Ubuntu 20.04 (Tutorial). Please read on.
Before starting, you will need to update and upgrade all your system packages to the latest version. Update all of them by running the following command:
apt update -y
apt upgrade -y
After updating all the system packages, you can proceed to install Git on your server.
The simple and easiest way to install Git is to install it from the Ubuntu default repository. However, these repositories may be older than the newest version currently available.
apt install git -y
Once the Git is installed, you can verify the Git installation using the following command:
git --version
You should see the Git version in the following output:
This method is flexible but it will take longer time and you can not manage it via package manager. Before starting, you will need to install some dependencies required to compile the Git. You can install all of them by running the following command:
apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip -y
Once all the packages are installed, download the latest version of Git from the Git Hubrepository:
git clone https://github.com/git/git.git
Once the download is complete, navigate to the downloaded directory with the following command:
cd git
Next, start the compilation process with the following command:
make prefix=/usr/local all -j$(nproc)
Once the Git is compiled, you can install it with the following command:
make prefix=/usr/local install
After the installation, you can verify the Git version with the following command:
git --version
You should see the Git version in the following output:
At this point, Git is installed and configured on your server. Now, we will explain how to use Git in the development environment. First, create a new directory in your home directory with the following command:
mkdir gitrepo
Next, change the directory to the gitrepo using the following command:
cd gitrepo
Next, initiate the Git by running the following command:
git init
Next, add your Git repository with the following command:
How to Install and Configure Git on Ubuntu 20.04 (Tutorial) Conclusion
In this post, we explained how to install Git using two methods on Ubuntu 20.04. We also configure the Git, clone the remote repository then add the local file to the GitHub repository. You can now implement Git server in your development environment and start managing all codes from the central location.
Using Git, you can also run tests in the project without affecting the original version. Git tracks changes that you make to files. It creates a possibility to roll back to a particular version if necessary. Have a look at its features and benefits to learn more about Git.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.
00votes
Article Rating
Subscribe
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
DisagreeAgree
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.