CentOS安装git

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://***

2 comments

  1. says:

    一看就是强,顶一下。

  2. 捣乱 says:

    最近有个项目,可能需要服务器,CentOS怎么样?

Leave a comment