git push 401错误,安装新版的git

解决git clone时报错:The requested URL returned error: 401 Unauthorized while accessing

版本问题,最直接的解决办法就是重新编辑安装git吧:

下载安装源码

下载:wget -O git.zip https://github.com/git/git/archive/master.zip
解压:unzip git.zip
进入git目录:cd git-master

编译安装:

autoconf
./configure --prefix=/usr/bin/git
make
/usr/bin/perl Makefile.PL PREFIX='/usr/bin' INSTALL_BASE='' --localedir='/usr/bin/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

make报错了,git 需要perl来编译。然后重新make执行如下

yum install perl-ExtUtils-MakeMaker package

再make,又报错

make
 tclsh failed; using unoptimized loading
    MSGFMT    po/bg.msg make[1]: *** [po/bg.msg] 错误 127
make: *** [all] 错误 2

执行如下

yum install tcl build-essential tk gettext

再make,遇到如下错误

In file included from credential-store.c:1:
cache.h:40:18: warning: zlib.h: No such file or directory
In file included from credential-store.c:1:
cache.h:42: error: expected specifier-qualifier-list before ‘z_stream’
make: *** [credential-store.o] Error 1

安装zlib和zlib-devel

yum install zlib zlib-devel -y

安装之后使用https操作git 出现 :fatal: Unable to find remote helper for 'https'</li>

yum install -y curl curl-devel`

然后重新安装 git

make install

最后别忘了删掉旧的git,并把新版本的git建立软链接到 /usr/local/bin/git

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

标签: git

添加新评论