Tutorial for installing git on various Linux distributions

Time:2021-6-6

Git is a popular open source version control system (VCS), originally developed for Linux. Different from CVS or SVN, GIT’s version control system is considered as “distributed”. In a sense, GIT’s local working directory can be used as a fully functional warehouse, which has complete history and version tracking capabilities. In this working model, each collaborator submits the content to their local warehouse (as opposed to the core warehouse), and selectively pushes it to the core warehouse if necessary. This brings git, a version management system, the necessary scalability and redundancy for large-scale collaborative systems.

Installing git using package manager
Git is supported by all major Linux distributions. So the easiest way to install it is to use the package manager for each Linux distribution.

Debian, Ubuntu, or Linux MINT

Copy code

The code is as follows:

$ sudo apt-get install git

Fedora, CentOS or RHEL

Copy code

The code is as follows:

$ sudo yum install git

or

Copy code

The code is as follows:

$ sudo dnf install git

Arch Linux

Copy code

The code is as follows:

$ sudo pacman -S git

OpenSUSE

Copy code

The code is as follows:

$ sudo zypper install git

Gentoo

Copy code

The code is as follows:

$ emerge –ask –verbose dev-vcs/git

Install git from source code
If for some reason you want to install git from the source code, follow the instructions below.

Install dependency package

Before building git, install its dependency packages.

Debian, Ubuntu or Linux MINT

Copy code

The code is as follows:

$ sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev asciidoc xmlto docbook2x

Fedora, CentOS or RHEL

Copy code

The code is as follows:

$ sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc xmlto docbook2x

Compiling git from source code
From https://github.com/git/git/releases Download the latest version of GIT. Then build and install under / usr.

Note that if you plan to install to another directory (for example, / opt), replace the “- prefix = / usr” configuration command with another path.

Copy code

The code is as follows:

$ cd git-x.x.x
$ make configure
$ ./configure –prefix=/usr
$ make all doc info
$ sudo make install install-doc install-html install-info

Recommended Today

Supervisor

Supervisor [note] Supervisor – H view supervisor command help Supervisorctl – H view supervisorctl command help Supervisorctl help view the action command of supervisorctl Supervisorctl help any action to view the use of this action 1. Introduction Supervisor is a process control system. Generally speaking, it can monitor your process. If the process exits abnormally, […]