linux git升级安装以及报错问题解决方法


参考网址:

https://www.jianshu.com/p/512d25c9df10
https://blog.csdn.net/liuchenxia8/article/details/79652847
https://blog.csdn.net/qq_28903377/article/details/86148687
https://blog.csdn.net/daojibruce/article/details/75315401
https://www.cnblogs.com/gxldan/p/4069956.html

安装git

一、先安装编译时依赖的包

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

二、卸载旧版本

yum remove git

三、下载与安装

cd ~
wget https://www.kernel.org/pub/software/scm/git/git-2.15.1.tar.xz
tar -vxf git-2.15.1.tar.xz
cd git-2.15.1
make prefix=/usr/local/git all
make prefix=/usr/local/git install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
source /etc/profile
git --version

make prefix=/usr/local/git all编译的时候出现了错误:

 LINK git-credential-store
libgit.a(utf8.o): In function `reencode_string_iconv':
/usr/src/git-2.8.3/utf8.c:463: undefined reference to `libiconv'
libgit.a(utf8.o): In function `reencode_string_len':
/usr/src/git-2.8.3/utf8.c:502: undefined reference to `libiconv_open'
/usr/src/git-2.8.3/utf8.c:521: undefined reference to `libiconv_close'
/usr/src/git-2.8.3/utf8.c:515: undefined reference to `libiconv_open'
collect2: ld returned 1 exit status
make: *** [git-credential-store] Error 1
解决方法

一、安装libiconv

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar -zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv  &&  make  && make install

二、创建一个软链接到/usr/lib

ln -s /usr/local/lib/libiconv.so /usr/lib
ln -s /usr/local/lib/libiconv.so.2 /usr/lib

三、回到git目录继续编译

cd ~/git-2.15.1(我放在家目录)
make configure
./configure --prefix=/usr/local --with-iconv=/usr/local/libiconv
make
make install

四、编辑环境变量配置(给到所有用户): vim /etc/profile

1 export PATH=$PATH:/usr/local/git/bin  或者 echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc (需要退出 root 用户再操作. 否则就只有root用户内部才生效了)  
2 刷新配置:source /etc/bashrc

五、查看GIT版本

git --version  
git version 2.15.1
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linux 系统上,如果你克隆的 Git 仓库中包含中文文件,可能会出现编码问题。为了解决这个问题,你可以尝试以下几种方法: 1. 设置 Git 的文件名编码 可以通过设置 Git 的文件名编码来解决中文文件名乱码的问题。在终端中输入以下命令: ``` git config --global core.quotepath false ``` 这个命令会告诉 Git 在显示文件名时不要对其进行转义,从而避免中文文件名乱码的问题。 2. 设置 Linux 系统的语言环境 在 Linux 系统中,语言环境的设置可能会影响文件编码。你可以尝试在终端中输入以下命令: ``` export LANG="zh_CN.UTF-8" ``` 这个命令会将语言环境设置为中文 UTF-8 编码,从而解决中文文件名乱码的问题。 3. 使用 Git LFS 如果你的 Git 仓库中包含大型二进制文件,可以考虑使用 Git LFS 来管理这些文件。Git LFS 可以将这些文件存储在单独的服务器上,从而避免中文文件名乱码的问题。 综上所述,你可以尝试以上方法解决中文文件名乱码的问题。如果问题仍然存在,你可以尝试在 Git 克隆命令中指定文件编码,例如: ``` git clone --config core.autocrlf=input --config core.safecrlf=false --config core.quotepath=false --config core.filemode=false -c core.eol=lf -c i18n.commitencoding=utf8 -c i18n.logoutputencoding=utf8 -c i18n.commitencoding=utf8 -c i18n.logoutputencoding=utf8 <git-repo-url> ``` 在这个命令中,我们指定了 Git 的文件编码、换行符、字符集编码等参数,从而尽可能地避免中文文件名乱码的问题

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值