Git 版本导致 clone 故障

时间:2022-12-28 00:06:10


问题描述:

git clone 报错如下:

Initialized empty Git repository in /root/project_php/.git/
error: The requested URL returned error:
401 Unauthorized while accessing http://tone.verru.cn:88/project_php.git/info/refs

fatal: HTTP request failed

解决方法:

带着问题网上走一圈,查到资料说是 git 版本问题,建议升级到 1.8.3 以上。

shell > git --version
git version
1.7.1

# 好吧,那就升级。

shell > yum -y remove git
shell
> yum -y install perl cpio autoconf tk zlib-devel libcurl-devel openssl-devel expat-devel gettext-devel perl-ExtUtils-MakeMaker

shell
> cd /usr/local/src
shell
> wget https://www.kernel.org/pub/software/scm/git/git-2.10.0.tar.gz
shell > tar zxf git-2.10.0.tar.gz
shell
> cd git-2.10.0
shell
> autoconf
shell
> ./configure
shell
> make
shell
> make insntall

# 建议不要 ./configure; make; make install ,出问题不好排查

shell > echo "PATH=$PATH:/usr/local/bin/" >> /etc/profile; source /etc/profile

shell
> git --version
git version
2.10.0

# 再来克隆,发现正常。

shell > git clone http://tone.verru.cn:88/project_php.git

过程中小问题:

1、未安装 perl-ExtUtils-MakeMaker 报错如下:

/usr/bin/perl Makefile.PL PREFIX='/usr/local' INSTALL_BASE='' --localedir='/usr/local/share/locale'
Can
't locate ExtUtils/MakeMaker.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 .) at Makefile.PL line 3.
BEGIN failed--compilation aborted at Makefile.PL line 3.
make[1]: *** [perl.mak] 错误 2
make: *** [perl/perl.mak] 错误 2

2、未安装 expat-devel 报错如下:

git clone: fatal: Unable to find remote helper for 'http'

# 如果是 https 应该是未安装 libcurl-devel ,建议按照文档都装上。