我是 git-lfs
的新手,以下是我配置并尝试推送 git-lfs
的步骤git clone git@gitlab.example.com:group/project.git
将 tar.gz lfs 文件从不同的 repo 复制到我当前的 repo,然后
git lfs install
git lfs track "*.tar.gz"
git add .gitattributes
git commit -m "message"
而 git push origin master
:我面临的错误:
(missing) code.tar.gz (f2b4bf22bcb011fef16f80532247665d15edbb9051***)
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s, done.
hint: Your push was rejected due to missing or corrupt local objects.
hint: You can disable this check with: 'git config lfs.allowincompletepush true'
error: failed to push some refs to 'git@gitlab.example.com:group/project.git'
供您引用:当我运行 ls .git/lfs/objects/f2/b4
时,我无法在里面找到任何东西。但是对于其他 tar 文件,如果我运行
ls .git/lfs/objects/g3/8a
,我可以看到 c5a9a2e024875718b6377bb15a42fac872a3**** 值
最佳答案
我通过下载从该特定分支引用的 lfs 对象来解决它:
git lfs fetch --all <remote-name> <branch-name>
它将填充丢失的文件 .git/lfs/objects 文件夹
关于由于丢失或损坏的本地对象 git-lfs,git push 被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64316551/