天际说

CentOS安装git

发布时间:2013年8月24日 / 分类:CentOS相关 / 6,994 次围观 / 抢沙发!

CentOS默认源是没有git的,所以希望通过yum install来安装的童鞋们,不要在错误的道路上越走越远…… 所以,要从源安装,对应的命令:

yum -y install zlib-devel openssl-devel perl cpio expat-devel gettext-devel

wget http://git-core.googlecode.com/files/git-1.7.7.5.tar.gz

./configure –prefix=/usr/local/git

make

make install

然后对执行文件进行链接,当然,如果安装在/usr/local目录的话,就不用这步了。

ln -s /usr/local/git/bin/git /usr/local/bin/git

ln -s /usr/local/git/bin/gitk /usr/local/bin/gitk

ln -s /usr/local/git/bin/git-shell /usr/local/bin/git-shell

ln -s /usr/local/git/bin/git-upload-pack /usr/local/bin/git-upload-pack

ln -s /usr/local/git/bin/git-cvsserver /usr/local/bin/git-cvsserver

ln -s /usr/local/git/bin/git-receive-pack /usr/local/bin/git-receive-pack

ln -s /usr/local/git/bin/git-upload-archive /usr/local/bin/git-upload-archive

 

常见问题

1、如果出现“git: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory” 在确认已经安装iconv库的情况下,执行以下命令:

 

echo "/usr/local/lib" > /etc/ld.so.conf.d/git.conf

/sbin/ldconfig

 

2、如果在“git clone https://***”时出现“error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing”

 

在使用git前加上“GIT_SSL_NO_VERIFY=true”的环境变量,即:

env GIT_SSL_NO_VERIFY=true git clone https://***

标签:none