Http://forkhope.diandian.com/post/2012-10-04/40040973375
1. Use sudo apt-Get install Git-core to install git. At this time, this git may not be the latest version.
If you want to install the latest version of git, You need to compile and install the source code.
Download Page of git Official Website
Http://git-scm.com/downloads
The source code is not provided for download (this website may be blocked), but we need to go to GitHub to download the GIT source code, so we still need to install a git first.
2. Install git with the above command, and then use
Git clone https://github.com/git/git.git
Command to obtain the GIT source code. Assume that the obtained source code is located in the home directory. After the download is complete, a git directory will be added under the home directory.
3. Go to the GIT directory and compile and install the source code.
$ CD git
4. Compile the source code. Both the "all" and "Doc" targets are specified here. If you specify "all" to install the help document of git in the man manual, the help document of git is not included by default if you only specify "all, in this way, the help of git cannot be found in the man manual.
$ Make prefix =/usr/local all Doc
When compiling all targets, the following error may be reported:
/Bin/sh: curl-config: not found
Fatal error: OpenSSL/SSL. h: no such file or directory
This is because some Development kits required by git source code are not installed. I solve this problem by installing the following package:
$ Sudo apt-Get install libcurl4-openssl-dev
There is a way to install the libssl-dev package on the Internet. This method can solve fatal error: OpenSSL/SSL. h: No such file or directory problem, but the/bin/sh: curl-config: Not found problem still exists. It cannot be compiled during compilation. On my machine, installing the libcurl4-openssl-dev can solve both of these problems at the same time and will automatically install the libssl-dev package when installing the libcurl4-openssl-dev.
When compiling the doc object, the following error may be reported:
/Bin/sh: Line 1: asciidoc: Command not found
The asciidoc command cannot be found. Install this command:
$ Sudo apt-Get install asciidoc
On my machine, install this command. The file at 477m will be downloaded.
After these packages are installed, run the make prefix =/usr/local all Doc command again and you will not see the error.
5. Uninstall the old installed version git.
At this point, because an old version of git has been installed on our machine, in order to prevent conflicts, I will first Uninstall this old version of git. If you do not uninstall it, you do not know whether it will affect it.
$ Sudo apt-Get purge Git-core
$ Sudo apt-Get autoremove -- purge
6. Install
$ Sudo make prefix =/usr/local install-Doc
Similarly, if you want to see the GIT help documentation in the man manual, additional installation is required, that is, the above install-Doc. If only the install target is specified, the help of git commands cannot be found in the man manual.
7. Check the newly installed git version and check whether the new version is available.
$ Git -- version
Git version 1.8.0-RC0
Good. installation is complete!