开发工具 · Tool

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

•̀.̫•́✧ · 8月3日 · 2020年本文585字 · 阅读2分钟584

问题

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

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

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

解决方案

分步克隆

克隆最新一次 commit

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

然后下载所有历史

$ git fetch --unshallow

或者克隆剩余所有

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

或者克隆某一分支

$ git remote set-branches origin 'cnguu'
$ git fetch origin cnguu
$ git checkout cnguu
0 条回应