Reference url:http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=25150840&id=4250659
If conditions permit, there are many benefits of installing from source code, at least the latest version can be installed. Every version of Git is constantly trying to improve the user experience, so it's great to be able to compile and install the latest version yourself from the source code. Some Linux versions come with packages that aren't updated in a timely fashion, so unless you're using the latest distro or backports, installing from the source code is the best option.
Git's work calls for code from libraries such as CURL,ZLIB,OPENSSL,EXPAT,LIBICONV, so you need to install these dependent tools first. On systems with Yum (such as Fedora) or systems with apt-get (such as the Debian system), you can install them using the following command:
$ yum Install curl-devel expat-devel gettext-devel openssl-devel zlib-devel$ apt-get Install Libcurl4-gnutls-dev Libexpat1-dev GetText
Then, download the latest version of the source code from the following Git official site:
Then compile and install:
You can now use GIT commands to clone the GIT project repository locally so that it's ready to be updated at a later time:
$ git clone git://git.kernel.org/pub/scm/git/git.git
Source code Install Git