Getting started with Linux: Install Git on Linux
Problem: I tried to clone a project from a Git public repository, but the error message "git: command not found" appeared ". How can I install Git on a certain Linux release?
Git is a popular open-source version control system (VCS) that was initially developed for the Linux environment. Unlike version control systems such as CVS or SVN, Git version control is regarded as "distributed". In a sense, git's local working directory can be used as a fully functional repository with complete history and version tracking capabilities. Under this working model, collaborators submit the content to their local warehouse (Instead, the content is always submitted to the core warehouse). If necessary, then, we can selectively push data to the core repository. This provides the scalability and redundancy required for the version management system of Git.
Use the Package Manager to install Git
Git has been supported by all mainstream Linux distributions. Therefore, the simplest way to install it is to use the package manager of each Linux release.
Debian, Ubuntu, or Linux Mint
$ sudo apt-get install git
Fedora, CentOS or RHEL
$ sudo yum install git
Or
$ sudo dnf install git
Arch Linux
$ sudo pacman -S git
OpenSUSE
$ sudo zypper install git
Gentoo
$ emerge --ask --verbose dev-vcs/git
Install Git from source code
If you want to install Git from the source code for some reason, follow the instructions below.
Install dependency packages
Install the dependent package before building Git.
Debian, Ubuntu or Linux Mint
$ sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev asciidoc xmlto docbook2x
Fedora, CentOS or RHEL
$ sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc xmlto docbook2x
Compile Git from source code
Download the latest version of Git from the https://github.com/git/git/releases. Then build and install the SDK under/usr.
Note: If you want to install it in another directory (for example,/opt), replace the "-- prefix =/usr" configuration command with other paths.
$ cd git-x.x.x
$ make configure
$ ./configure --prefix=/usr
$ make all doc info
$ sudo make install install-doc install-html install-info
GitHub Tutorials:
GitHub tutorials
Git tag management details
Git branch management
Git remote repository details
Git local Repository (Repository) Details
Git server setup and Client installation
Git Overview
Share practical GitHub tutorials
How to Build and use Git servers in Ubuntu
Git details: click here
Git: click here
Via: How to install git on Linux
Author: Dan Nanni Translator: mr-ping Proofreader: wxy
This article was originally translated by LCTT and launched with the Linux honor in China
This article permanently updates the link address: