参考:http://blog.csdn.net/yingzinanfei/article/details/53165369‘
https://www.cnblogs.com/grimm/p/5368777.html
-
CentOS6.5自带的git版本是1.7.1
-
卸载自带的git
# yum remove git
- 下载最新版git
# wget https://github.com/git/git/archive/v2.15.1.tar.gz (这里不知道怎么去找最新版本,后来去官网找了新的版本号,将此处替换)
- 解压
# tar zxvf v2.15.1.tar.gz
# cd git-2.15.1
- 编译安装
# make --prefix=/usr/common/git all
# make --prefix=/usr/common/git install
- 修改环境变量(这里应该是有多种方法,可以参考:linux修改环境变量)
# cd
# vim .bashrc
在最后一行添加
export PATH=/usr/common/git/bin:$PATH
保存后使其立即生效
# . .bashrc
- 查看是否安装成功
#git --version
- 创建仓库
[root@init ~]# cd /usr/common #进入目录
[root@init common]# ll
total 4
drwxr-xr-x. 5 root root 4096 Jan 12 22:01 git
[root@init common]# mkdir gitrepo #创建一级目录
[root@init common]# cd gitrepo
[root@init gitrepo]# ll
total 0
[root@init gitrepo]# mkdir project1 #创建二级目录
[root@init gitrepo]# cd project1/
[root@init project1]# ls
[root@init project1]# git init --bare #初始化仓库
Initialized empty Git repository in /usr/common/gitrepo/project1/
[root@init project1]# ls #查看初始化以后的目录
branches config description HEAD hooks info objects refs
[root@init project1]#
安装插曲:
插曲1:
Git在make的时候报错:Can't locate ExtUtils/MakeMaker.pm in @INC
解决方法如下:
yum -y install perl-devel perl-CPAN
git 需要perl来编译。然后重新make
插曲2:
Git Make时出现:tclsh failed; using unoptimized loading
MSGFMT po/bg.msg make[1]: *** [po/bg.msg] 错误 127
yum install tcl build-essential tk gettext
插曲3:
安装之后使用https操作git 出现 :fatal: Unable to find remote helper for 'https'
yum install -y curl curl-devel
然后重新安装 git
插曲4:
Can't locate ExtUtils/Embed.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.
到网上搜索, 需要安装perl-ExtUtils-Embed:
yum install perl-ExtUtils-Embed -y
插曲5:
在编译doc目标时,可能会报下面的错:
/bin/sh: line 1: asciidoc: command not found
这个包可以到这里下载并执行make(./configure ;make ;make install)常用方法安装http://sourceforge.net/projects/asciidoc
插曲6:
报错:XSLTPROC user-manual.html时报错
过程:yum search XSLTPROC
[root@bogon git-master]# yum search XSLTPROC
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirrors.163.com
============================== Matched: XSLTPROC ===============================
libxslt.i386 : Library providing the Gnome XSLT engine
libxslt.x86_64 : Library providing the Gnome XSLT engine
解决:yum install libxslt.x86_64
插曲7:
/bin/sh: line 1: xmlto: command not found
yum install xmlto