美文网首页Linux
Linux软件安装 | git下载安装

Linux软件安装 | git下载安装

作者: 生信师姐 | 来源:发表于2020-08-28 11:00 被阅读0次

1. 安装linux环境git依赖包

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

2. 下载git安装包

两种方式:

yum install git
  • wget
wget -c -t=0 https://www.kernel.org/pub/software/scm/git/git-2.8.3.tar.gz

3. 解压tar,编译安装

cd git-2.8.3
make configure
./configure --prefix=/usr/git          ##配置目录
make profix=/usr/git
make install

4. 加入环境变量

echo "export PATH=/usr/git/bin:$PATH" >> ~/.bashrc
source ~/.bashrc

5. 完成-检查版本

git --version 

常见问题

问题1
error: RPC failed; result=18, HTTP code = 200B | 13.00 KiB/s
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

原因:整个库较大,postBuffer 默认值较小的原因

解决方法1
clone https方式换成SSH的方式,把 https:// 改为 git://

# 例:
git clone https://github.com/libgit2/libgit2

# 改为:
git clone git://github.com/libgit2/libgit2

解决方法2:重新设置通信缓存大小

git config --global http.postBuffer 524288000

这样已经配置好了,如果你不确定,可以根据以下命令查看postBuffer。

git config --list

如果失败并显示错误:RPC失败;result = 18,HTTP代码= 200,通过在配置中进一步增加postBuffer来重试

git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master

解决方法3:少clone一些,每个文件只取最近一次提交,不是整个历史版本

git clone https://github.com/flutter/flutter.git --depth 1

相关文章

网友评论

    本文标题:Linux软件安装 | git下载安装

    本文链接:https://www.haomeiwen.com/subject/kigksktx.html