Git is a popular open source version control system (VCS) that was originally developed for the Linux environment. Unlike CVS or SVN version control systems, Git's versioning is considered "distributed", and in a sense, Git's local working directory can be used as a fully functional warehouse with complete history and version tracking capabilities. Under this working model, each collaborator submits content to their local repository (which is always submitted to the core repository) and, if necessary, is selectively pushed to the core repository. This brings the scalability and redundancy required by a large collaboration system to git, the version management system.
Install git using the Package Manager
Git has been supported by all the mainstream Linux distributions. So the easiest way to install it is to use the Package Manager for each Linux distribution.
Debian, Ubuntu, or Linux Mint
The code is as follows:
$ sudo apt-get install git
Fedora, CentOS or RHEL
The code is as follows:
$ sudo yum install git
Or
The code is as follows:
$ sudo DNF install git
Arch Linux
The code is as follows:
$ sudo pacman-s git
OpenSUSE
The code is as follows:
$ sudo zypper install git
Gentoo
The code is as follows:
$ emerge--ask--verbose Dev-vcs/git
Install Git from source
If for some reason you want to install Git from the source code, follow the instructions below.
Install Dependency Pack
Before you build git, install its dependent packages first.
Debian, Ubuntu or Linux Mint
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
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
Download the latest version of Git from https://github.com/git/git/releases. Then build and install in/usr.
Note that if you plan to install to a different directory (for example:/OPT), replace the "--prefix=/usr" configuration command with a different path.
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