Linux Install Git

Source: Internet
Author: User
Tags svn version control system git clone git commands

One. Package Manager mode installation

It is easiest to install git with the Linux distribution Package Manager, and it will automatically configure the command completion function. However, the installed git may not be the latest version.

    •   Ubuntu 10.10 or newer version , Debian (squeeze) or newer version:
sudo aptitude install gitsudo aptitude Install Git-doc git-svn git-email Git-gui  gitk

Ubuntu 10.04 (lucid) or older version, Debian (Lenny) or older version:

sudo aptitude install git-coresudo aptitude Install Git-doc git-svn git-email Git-gui gitk

 Description: In the older version of Debian, package git actually refers to GNU Interactive Tools, not git as a version control system. Git as a version control system is in the package Git-core.

The GIT package contains most of the Git commands and is a must-install package.

Packages GIT-SVN, Git-email, Git-gui, GITK are also part of the GIT package, but because packages git-svn, Git-email, Git-gui, and GITK are also part of the GIT package, But because of the different dependencies of the package (such as more Perl modules and TK), it is released as a package separately.

The package Git-doc contains Git's HTML-formatted document, which you can choose to install. If Git's package git-doc is installed, it contains a git HTML-formatted document that you can choose to install. If you have a git HTML-formatted document installed, you can use the git help-w <sub-command> command to get HTML Help from a Web browser to open related subcommands <sub-comman>.

    • RHEL, Fedora, CentOS:  
Yum Install Gityum install git-doc git-svn git-email Git-gui gitk

  

Two. installing from the source

Visit Git's official website: http://git-scm.com/. Download Git source package. The installation process is as follows:

1. Expand the source package and go to the appropriate directory.

Tar  -jxvf git-1.8.3.1.tar.bz2cd git-1.8.3.1/

2. The installation method is written in the install file, which can be completed by referring to the instructions. The following command installs Git in/usr/local/bin.

Make  prefix=/usr/local  allsudo make prefix=/usr/local  Install

3. Install the Git document (optional)

Compiled documents are primarily HTML-formatted documents that are easy to view via git help-w <sub-command> commands. In fact, even if you don't install git docs, you can use the man manual to view git help, and use the command git helper <sub-command> or git <sub-command>--help.

Compiling the document relies on AsciiDoc, so you need to install AsciiDoc first and then compile the document. It takes a lot of time to compile the document and be patient.

Make prefix=/usr/local odc infosudo make prefix=/usr/local  install-doc  install-html  install-info

After the installation is complete, you can find the git command under the/usr/local/bin command.

Iii. installing from a Git repository

If you clone a Git project's repository locally, you can get the latest version of Git in sync with the repository, so that when you download different versions of Git source code, you actually take the incremental approach, saving time and space. Of course, the premise of using this method is that Git has been installed in other ways, and the procedure is as follows.

(1) Clone the repository of the GIT project to local.

git clone git://git.kernel.org/pub/scm/git/git.gitcd git

(2) If the repository for a GIT project has been cloned locally, update it directly in the workspace to get a newer version of Git.

git fetch

(3) Perform cleanup work to avoid the legacy files that were previously compiled have an impact on compilation. Note that the following operation will discard local changes to git code.

Git clean-fdx
git reset --hard

(4) Review the GIT milestones and choose the latest version to install

git tag

(5) Check out this version of the code

git checkout v.1.8.3.1

(6) Perform the installation. For example, install to the/usr/local directory.

Make prefix=/usr/local all DOC info
sudo make prefix=/usr/local install \
Install-doc install-html install-info

  

 

  

Linux Install Git

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.