GIT is a service that facilitates the work of updating various information on a remote server, also by different people. And this is not only about software development, but also, for example, storing and synchronizing passwords of the Password Store program. With this version control system, it’s easier to keep track of data changes and make changes quickly. This article describes how to install GIT on Ubuntu and other GNU/Linux systems.
Installing GIT via PM
Since GIT is the leader among all known version control systems, many distributions, if they do not install it by default, then at least add it to the standard repository. Probably there will not be the latest, but stable version.
In almost all operating systems, the necessary package is called git. Below are the installation commands for some distributions. Please note that these actions require appropriate privileges, so either append sudo first, or log in as superuser.
|Debian/Ubuntu/Mint||apt install git|
|Arch/Manjaro||pacman -S git|
|Fedora 22+||dnf install git|
|openSUSE||zypper install git|
The package can also be found in the graphical PM.
In Ubuntu, you can add another GIT repository to install its latest version:
add-apt-repository ppa:git-core/ppa && apt update && apt install git
Installing GIT from Source
This method is usually used just to operate the latest version of GIT in Ubuntu and Fedora. However, there is no other option for RHEL, Oracle Linux, CentOS systems (in fact, there is the IUS Community Project, but this is another story).
First download all the dependencies you need:
|Fedora||dnf install curl-devel expat-devel gettext-devel openssl-devel zlib-devel|
|Ubuntu||apt install build-essential libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev unzip|
Extract the files from the archive of one of the following commands (in this case, the GIT version is 2.23.0):
|tar archive||tar -zxf git-2.23.0.tar.gz|
|zip archive||unzip git-2.23.0.zip|
Go to the newly created folder and execute the line:
make prefix=/usr/local all && sudo make prefix=/usr/local install
Now, located in this directory, you can update GIT with the command:
git clone git://git.kernel.org/pub/scm/git/git.git