root権限が無い状態でもgitを使えるように環境構築

git をローカルで使えるようにインストールしてみる

必要なもの
・git
http://kernel.org/pub/software/scm/git/
git-1.6.3.tar.gz

・zlib
http://zlib.net/
zlib-1.2.3.tar.gz
(zlibが無いとインストールできないようだ。すでに入っているなら不要

 $ ./configure --prefix=$HOME/usr/local --with-zlib=no
 configure: Setting lib to 'lib' (the default)
 configure: Will try -pthread then -lpthread to enable POSIX Threads.
 configure: CHECKS for site configuration
 configure: error: You cannot use git without zlib

 )

# インストール場所作成
$ mkdir -p $HOME/usr/local

# 一時ディレクトリで作業する
$ mkdir /tmp/aaa

# zlibをインストールする
$ cd /tmp/aaa
$ curl -O http://www.zlib.net/zlib-1.2.3.tar.gz
$ tar xzvf zlib-1.2.3.tar.gz
$ cd zlib-1.2.3/
$ ./configure --help
$ ./configure --prefix=$HOME/usr/local
$ make
$ make install

# git をインストール
$ cd /tmp/aaa
$ curl -O http://kernel.org/pub/software/scm/git/git-1.6.3.tar.gz
$ tar xzvf git-1.6.3.tar.gz
$ cd git-1.6.3/
$ ./configure --help
$ ./configure --prefix=$HOME/usr/local --with-zlib=$HOME/usr/local/
$ make
$ make install

# ローカルにパスを通す
$ echo export "PATH=$PATH:$HOME/usr/local/bin/" >> $HOME/.bashrc
$ source $HOME/.bashrc

# パスが通っているのを確認
$ git --version
git version 1.6.3