The old git version on workstation can not satisfy me. It is not convenient to used, and cannot push to GitHub. Then I want to install Git from source code. This really killing me. Here are some experience.
There are a lot of articles online to show that compile git from source code, as long as you can "sudo apt-get install ****(a lot of libraries)". This is ridiculous. If I can use sudo, why not directly install it from repository?
Here are some ideas about what we need to install. http://www.angularjs.cn/A0HC. However, the author use brew, which needs ruby to install. I don't know how to install ruby without root. However, this is an elegant idea to do this work, and can be referred if possible. The linuxbrew can be found at: http://linuxbrew.sh/. Besides, it seems that it requires curl supporting https, which is exactly the problem I will talk about next.
Install Git is not big. However, it depends several libraries. During the installation, it requires something like xmlto, asciidoc, etc. Just download and compile them, not big deal. Then we can
$ ./make configure $ ./configure --prefix=$HOME/git $ make & make install
Seems wonderful. It can be used without problem locally. However, when I want to push or clone from repository, it shows:
fatal: Unable to find remote helper for 'https'
After searching on the internet, it seems that this is caused by curl. We need to install the curl.
So, download and install as usual. It works, but without https support, when git push/pull, we have error
fatal: unable to access 'https://***@bitbucket.org/***/***': Protocol "https" not supported or disabled in libcurl
In order to configure curl with hppts, t seems we need libssh2
./configure --prefix=$HOME/curl --with-libssh2
Still cannot, there is no libssh2, so we download libssh2. Still cannot, since we need gnu-crypto, so download, it requires javac. There is no javac...... I want to stop. I think there is way to compile libssh2 with system crypto, but I have no time to try.
Do it another way. I found that there is also curl in anaconda package, so we can try to compile Git it like this (http://www.cnblogs.com/wowarsenal/p/4319002.html)
$ ./make configure $ ./configure --prefix=$HOME/git --with-curl=$HOME/anaconda $ make & make install
Configure without problem. However, when running, it shows:
git: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory
Obviously we still need this crypto library. Try this in the system lib, we can find a /usr/lib64/libcrypt.so. So here's a tricky,
$ mkdir -p $HOME/usr/lib $ ln -s /usr/lib64/libcrypt.so libcrypto.so.1.0.0
Then add $HOME/usr/lib to LD_LIBRARY_DIR
Anyway, it works. So stop now.
1. There is still problem in the config.log
/usr/bin/ld: cannot find -lexpat ( it seems this is required, http://stackoverflow.com/questions/8329485/git-clone-fatal-unable-to-find-remote-helper-for-https)
2. make install will exit error, don't know why
3. make doc will have problem