git(學習之二)編譯安裝




Git學習筆記
#####################################################
qq:1218761836
qq羣:150181442
#####################################################

Git安裝
1.    Yum安裝git
yum install git –y
yum install -y  git-email git-gui gitk git-svn git-cvs    
其中git-svn  git-cvs 是支持svn  cvs協同工做時須要(可選擇)
2.    開啓git命令補齊功能(不過我測試不加這個也能夠補齊)
. /etc/bash_completion.d/git 或者source /etc/bash_completion.d/git  
#運行此命令後便可在服務器上使用git的命令補齊功能。爲了可以在終端開啓時自動加載bash_completion腳本,須要在系統配置文件/etc/profile及本地配置文件~/.bashrc 中添加下面的內容。
#add  git
if [ -f /etc/bash_completion.d/git ]; then  
. /etc/bash_completion.d/git
fi
固然這裏/etc/bash_completion.d/git的git腳本也能夠複製源文件替換,
cp /usr/share/doc/git-1.7.1/contrib/completion/git-completion.bash /etc/bash_completion.d/
而後把文件中涉及到的git替換成git-completion.bash便可
參考: http://git-scm.com/download/linux
編譯安裝
編譯安裝須要安裝一些git須要的庫
yum install curl-devel expat-devel gettext-devel  openssl-devel zlib-devel  gcc*  \
perl perl-devel texinfo  xmlto   -y  
爲了可以添加更多格式的文檔(如 doc,html,info) 須要安裝所依賴的包
yum install asciidoc xmlto   -y
docbook2x 這個庫須要額外安裝
wget http://centos.karan.org/el5/extras/testing/i386/RPMS/docbook2X-0.8.8-1.el5.kb.i386.rpm
rpm -ivh docbook2X-0.8.8-1.el5.kb.i386.rpm –nodeps
cd /usr/bin/
ln -s db2x_docbook2texi docbook2x-texi
ll docbook2x-texi
獲取源碼包:
https://www.kernel.org/pub/software/scm/git/  
https://github.com/git/git/releases
    一般在 GitHub 上的是最新版本,但 kernel.org 上包含有文件下載簽名,若是你想驗證下載正確性的話會用到。
wget https://www.kernel.org/pub/software/scm/git/git-2.5.0.tar.gz    
tar xvf git-2.5.0.tar.gz -C /usr/local/src/  
[root@wx git-2.5.0]# less INSTALL  
                Git installation

Normally you can just do "make" followed by "make install", and that
will install the git programs in your own ~/bin/ directory.  If you want
to do a global install, you can do

        $ make prefix=/usr all doc info ;# as yourself
        # make prefix=/usr install install-doc install-html install-info ;# as root

(or prefix=/usr/local, of course).  Just like any program suite
that uses $prefix, the built results have some paths encoded,
which are derived from $prefix, so "make all; make prefix=/usr
install" would not work.

The beginning of the Makefile documents many variables that affect the way
git is built.  You can override them either from the command line, or in a
config.mak file.

Alternatively you can use autoconf generated ./configure script to
set up install paths (via config.mak.autogen), so you can write instead

        $ make configure ;# as yourself
        $ ./configure --prefix=/usr ;# as yourself
        $ make all doc ;# as yourself
        # make install install-doc install-html;# as root

…………………………………………………………………………………………………………………………….
[root@wx-a git-2.5.0]# make configure
GIT_VERSION = 2.5.0
    GEN configure
[root@wx-a git-2.5.0]# ./configure –help # 查看安裝的參數html

[root@wx-a git-2.5.0]# ./configure --prefix=/application/git
[root@wx-a git-2.5.0]# make all doc info
[root@wx-a git-2.5.0]# make install install-doc install-html install-info
.................................................................................................................................
make[1]: Leaving directory `/usr/local/src/git-2.5.0/Documentation'
make -C Documentation install-info
make[1]: Entering directory `/usr/local/src/git-2.5.0/Documentation'
make[2]: Entering directory `/usr/local/src/git-2.5.0'
make[2]: `GIT-VERSION-FILE' is up to date.
make[2]: Leaving directory `/usr/local/src/git-2.5.0'
install -d -m 755 /application/git/share/info
install -m 644 git.info gitman.info /application/git/share/info
if test -r /application/git/share/info/dir; then \
          install-info --info-dir=/application/git/share/info git.info ;\
          install-info --info-dir=/application/git/share/info gitman.info ;\
        else \
          echo "No directory found in /application/git/share/info" >&2 ; \
        fi
No directory found in /application/git/share/info
make[1]: Leaving directory `/usr/local/src/git-2.5.0/Documentation'node


man git 查看git命令的使用說明
linux

[root@wx-a ~]# man git
GIT(1)                            Git Manual                            GIT(1)

NAME
       git - the stupid content tracker

SYNOPSIS
       git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
           [-p|--paginate|--no-pager] [--no-replace-objects]
           [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
           [--help] COMMAND [ARGS]

DESCRIPTION
       Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both
       high-level operations and full access to internals.

       See gittutorial(7) to get started, then see Everyday Git[1] for a useful minimum set of commands, and "man
       git-commandname" for documentation of each command. CVS users may also want to read gitcvs-migration(7). See the Git
       User’s Manual[2] for a more in-depth introduction.

       The COMMAND is either a name of a Git command (see below) or an alias as defined in the configuration file (see git-
       config(1)).

       Formatted and hyperlinked version of the latest git documentation can be viewed at
       http://www.kernel.org/pub/software/scm/git/docs/.   #man   git的在線說明文檔git

......................................................................................................................................................................github






備註:編譯的時候可能會遇到錯誤,若是遇到如下故障centos

make的時候出錯大都和依賴包有問題,若是安裝的了相應的依賴包,編譯起來很方便
bash

錯誤一
/bin/sh: line 1: xmlto: command not found
make[1]: *** [git-add.1] Error 127
make[1]: Leaving directory `/usr/local/src/git-1.7.12.3/Documentation'
make: *** [install-doc] Error 2

依賴包的問題
yum install -y xmlto

錯誤二
/bin/sh: line 1: docbook2x-texi: command not found
make[1]: *** [user-manual.texi] Error 127
make[1]: Leaving directory `/usr/local/src/git-1.7.12.3/Documentation'
make: *** [install-info] Error 2

git完整安裝須要asciidoc,docbook2X
yum install -y openjade  texinfo  perl-XML-SAX
cd /usr/local/src
wget http://centos.karan.org/el5/extras/testing/i386/RPMS/docbook2X-0.8.8-1.el5.kb.i386.rpm
rpm -ivh docbook2X-0.8.8-1.el5.kb.i386.rpm --nodeps
cd /usr/bin
ln -s db2x_docbook2texi docbook2x-texi



服務器

相關文章
相關標籤/搜索