Git 克隆大型仓库失败解决方法

时间:2022-07-28
本文章向大家介绍Git 克隆大型仓库失败解决方法,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

# 问题

克隆一个大型仓库,约 270 M

git clone https://xxxxxx.git,报错:

error: pack-objects died of signal 15, 37.61 MiB | 265.00 KiB/s
remote: aborting due to possible repository corruption on the remote side.
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
Gitea: Internal error
Failed to execute git command: exit status 128
fatal: index-pack failed

1 2 3 4 5 6 7

# 解决方案

# 分步克隆

克隆最新一次 commit

$ git clone https://xxxxxx.git --depth 1

1

然后下载所有历史

$ git fetch --unshallow

1

或者克隆剩余所有

$ git remote set-branches origin '*'
$ git fetch -v

1 2

或者克隆某一分支

$ git remote set-branches origin 'cnguu'
$ git fetch origin cnguu
$ git checkout cnguu

1 2 3