CentOS默认源是没有git的,所以希望通过yum install来安装的童鞋们,不要在错误的道路上越走越远……
所以,要从源安装,对应的命令:
yum -y install zlib-devel openssl-devel perl cpio expat-devel gettext-devel
wget https://www.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
tar zxvf
git-2.9.5.tar.gz
cd git-2.9.5
./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
在使用git前加上“GIT_SSL_NO_VERIFY=true”的环境变量,即:
env GIT_SSL_NO_VERIFY=true git clone https://***
------------
https://www.kernel.org/pub/software/scm/git/
No comments:
Post a Comment