Git仅克隆最新一次提交

QQ图片20230724204724

最近想把chatglm2的仓库拉下来

结果一直就,本地SSL握手超时

境外的小鸡嘛...

root@sora-debian-s-1vcpu-1gb-sgp1-01:/mnt/Public/huggingface# git clone https://huggingface.co/THUDM/chatglm2-6b
Cloning into 'chatglm2-6b'...
remote: Enumerating objects: 177, done.
remote: Counting objects: 100% (76/76), done.
remote: Compressing objects: 100% (61/61), done.
remote: Total 177 (delta 48), reused 15 (delta 15), pack-reused 101
Receiving objects: 100% (177/177), 1.94 MiB | 8.00 MiB/s, done.
Resolving deltas: 100% (89/89), done.
Updating files: 100% (18/18), done.
Killeding content: 37% (3/8), 1005.01 MiB | 6.59 MiB/s

咱真的谢谢你嗷,硬盘都给写炸了还拉不下来

FUCK

正文

这种仓库都用上lfs了,里面的文件自然也是大的吓人

git这玩意自古就有二进制提交体积迅速变大的毛病

那么直接拉取最新的更新可能是个比较好的方法

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

这样就能把默认分支的最新更新拉下来

如果需要其他的分支的话,可以这样

git remote set-branches origin 分支名称
git fetch --depth 1 origin 分支名称
git checkout 分支名称

--depth参数决定了拉取的文件是最新的几次提交

如果不是没办法了不建议用这种方式,少了历史提交记录肯定容易出一些奇怪的问题

另外,用 lfs的仓库如果没拉取完毕要接着拉可以用这个

git restore --source=HEAD :/
点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注