git clone 超过1G的项目报错
2023-03-15 本文已影响0人
Hilbert1
git clone 超过1G项目报错
C:\Users\meiktv\StudioProjects\meiktv_android_vod_3>git clone https://gitlab.meiktv.com/client/meiktv_android_vod.git
Cloning into 'meiktv_android_vod'...
remote: Enumerating objects: 46631, done.
remote: Counting objects: 100% (2627/2627), done.
remote: Compressing objects: 100% (199/199), done.
error: 24576 bytes of body are still expectediB | 2.91 MiB/s
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
解决方案:
分步骤clone 每次只clone一个分支:
C:\Users\meiktv\StudioProjects\meiktv_android_vod_3>git clone https://gitlab.xxxx.git --depth 60 //clone master最近60次提交,次数根据各自项目而定
Cloning into 'meiktv_android_vod'...
remote: Enumerating objects: 11398, done.
remote: Counting objects: 100% (11398/11398), done.
remote: Compressing objects: 100% (4831/4831), done.
remote: Total 11398 (delta 5141), reused 10406 (delta 4489), pack-reused 0
Receiving objects: 100% (11398/11398), 169.67 MiB | 2.98 MiB/s, done.
Resolving deltas: 100% (5141/5141), done.
Updating files: 100% (2179/2179), done.
再clone master分支剩下内容
C:\Users\meiktv\StudioProjects\meiktv_android_vod_3>git fetch --unshallow //需要进入到项目目录
fatal: not a git repository (or any of the parent directories): .git
C:\Users\meiktv\StudioProjects\meiktv_android_vod_3>cd meiktv_android_vod //进入项目目录
C:\Users\meiktv\StudioProjects\meiktv_android_vod_3\meiktv_android_vod>git fetch --unshallow //clone 剩下内容
remote: Enumerating objects: 21411, done.
remote: Counting objects: 100% (20245/20245), done.
remote: Compressing objects: 100% (4222/4222), done.
remote: Total 19226 (delta 11322), reused 18245 (delta 10446), pack-reused 0
Receiving objects: 100% (19226/19226), 42.55 MiB | 3.87 MiB/s, done.
Resolving deltas: 100% (11322/11322), completed with 549 local objects.
查看分支信息:
C:\Users\meiktv\StudioProjects\meiktv_android_vod_3\meiktv_android_vod>git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
只有master分支
clone 其他分支:
C:\Users\meiktv\StudioProjects\meiktv_android_vod_3\meiktv_android_vod>git remote set-branches origin feature_js2native_newui
C:\Users\meiktv\StudioProjects\meiktv_android_vod_3\meiktv_android_vod>git fetch --depth 50 origin feature_js2native_newui
remote: Enumerating objects: 2687, done.
remote: Counting objects: 100% (2687/2687), done.
remote: Compressing objects: 100% (1190/1190), done.
remote: Total 2487 (delta 1121), reused 2111 (delta 852), pack-reused 0Receiving objects: 91% (2264/2487), 253.41 MiB |Receiving objects: 92% (2289/2487), 253.41 MiB | 2.43 MiB/s
Receiving objects: 100% (2487/2487), 254.91 MiB | 2.88 MiB/s, done.
Resolving deltas: 100% (1121/1121), completed with 140 local objects.
From https://gitlab.meiktv.com/client/meiktv_android_vod
* branch feature_js2native_newui -> FETCH_HEAD
* [new branch] feature_js2native_newui -> origin/feature_js2native_newui
clone 此分支剩余内容:
C:\Users\meiktv\StudioProjects\meiktv_android_vod_3\meiktv_android_vod>git checkout feature_js2native_newui
Updating files: 100% (1027/1027), done.
Switched to a new branch 'feature_js2native_newui'
branch 'feature_js2native_newui' set up to track 'origin/feature_js2native_newui'.