Linux: install git
Blogs20102010-12-07
To better do the projects version control, I installed git in a Linux server. Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency. It is from Linus Torvalds himself, and use widely.
The following are the steps (to install git in /usr/bin, also install doc/ info/):
-- download $ wget http://kernel.org/pub/software/scm/git/git-1.7.3.3.tar.bz2 — extract $ tar -jxvf git-1.7.3.3.tar.bz2 — compile $ cd git-1.7.3.3 $ make prefix=/usr all doc info
Error occurs: curl-config can not found.
According to wiki, cURL is a computer software project providing a library and command-line tool for transferring data using various protocols. The cURL project produces two products, libcurl and cURL.
In order to install git, we need to install libcurl. Before start, we make sure gcc is installed. Without gcc, compile and build can’t execute.
-- download $ wget http://curl.haxx.se/download/curl-7.21.2.tar.gz — extract $ tar -zxvf curl-7.21.2.tar.gz — compile $ cd curl-7.21.2 $ make — install $ sudo make install
It works. So return to the beginning, to install git:
$ make prefix=/usr all doc info $ sudo make install
The installation succeeds, to double check it:
$ type git git is hashed (/usr/bin/git) $ git —version git version 1.7.3.3
Yes, it works. So next step, we can use git to do the version control.
$ git init $ git add $ git commit …
notice:‘make install’ need root privilege to install git binary files to system directory /usr/bin/, so root permission is needed. For in Windows, we need to install ’Git GUI’, a alternative useful tool is kdiff3, which compares files in a very efficient and smart way.
