William Jiang

JavaScript,PHP,Node,Perl,LAMP Web Developer – http://williamjxj.com; https://github.com/williamjxj?tab=repositories

Linux: install git

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: