首页 > 代码库 > git安装(CentOS 7)

git安装(CentOS 7)

git安装

# 系统版本

[puppet@salt git]$ cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core)

# 安装依赖(获取最新版本的时候才需要,直接用yum安装则忽略这些依赖)

[puppet@salt ~]$ sudo yum install curl-devel expat-devel perl-devel asciidoc xmlto docbook2X
# 安装完docbook2X的时候需要修改执行文件
[puppet@salt ~]$ cd /usr/bin/
[puppet@salt ~]$ sudo ln -s db2x_docbook2texi docbook2x-texi

# 安装git

[puppet@salt ~]$ sudo yum install git
[puppet@salt ~]$ sudo yum install git-svn git-email git-gui gitk
# 装完之后可以查看当前版本
[puppet@salt git]$ git --version
git version 1.8.3.1
# git tag 可以查看所有git版本
[puppet@salt git]$ git tag
gitgui-0.10.0
gitgui-0.10.1
....
v2.9.1
v2.9.2
v2.9.3

# 获取最新版本

[puppet@salt ~]$ git clone git://git.kernel.org/pub/scm/git/git.git
正克隆到 git...
remote: Counting objects: 218252, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 218252 (delta 1), reused 0 (delta 0)
接收对象中: 100% (218252/218252), 83.42 MiB | 279.00 KiB/s, done.
处理 delta 中: 100% (158777/158777), done.
[puppet@salt git]$ cd /data/git
[puppet@salt git]$ git checkout -b v2.9.3
切换到一个新分支 v2.9.3
[puppet@salt git]$ make prefix=/usr/local all doc info
    SUBDIR git-gui
    SUBDIR gitk-git
    SUBDIR perl
    SUBDIR templates
make -C Documentation all
make[1]: 进入目录“/data/git/Documentation”
make[2]: 进入目录“/data/git”
make[2]: “GIT-VERSION-FILE”是最新的。
make[2]: 离开目录“/data/git”
make[1]: 对“all”无需做任何事。
make[1]: 离开目录“/data/git/Documentation”
make -C Documentation info
make[1]: 进入目录“/data/git/Documentation”
make[2]: 进入目录“/data/git”
make[2]: “GIT-VERSION-FILE”是最新的。
make[2]: 离开目录“/data/git”
make[1]: 对“info”无需做任何事。
make[1]: 离开目录“/data/git/Documentation”
# 出现上面提示说明 make成功
[puppet@salt git]$ sudo make prefix=/usr/local install > install-doc install-html install-info
make[1]: 离开目录“/data/git/Documentation”
make -C Documentation install-html
make[1]: 进入目录“/data/git/Documentation”
make[2]: 进入目录“/data/git”
make[2]: “GIT-VERSION-FILE”是最新的。
make[2]: 离开目录“/data/git”
/bin/sh ./install-webdoc.sh /usr/local/share/doc/git-doc
make[1]: 离开目录“/data/git/Documentation”
make -C Documentation install-info
make[1]: 进入目录“/data/git/Documentation”
make[2]: 进入目录“/data/git”
make[2]: “GIT-VERSION-FILE”是最新的。
make[2]: 离开目录“/data/git”
install -d -m 755 /usr/local/share/info
install -m 644 git.info gitman.info /usr/local/share/info
if test -r /usr/local/share/info/dir; then   install-info --info-dir=/usr/local/share/info git.info ;  install-info --info-dir=/usr/local/share/info gitman.info ;else   echo "No directory found in /usr/local/share/info" >&2 ; fi
No directory found in /usr/local/share/info
make[1]: 离开目录“/data/git/Documentation”
# 提示上面信息说明安装成功

 

git安装(CentOS 7)