由于丢失或损坏的本地对象 git-lfs,git push 被拒绝

标签 git github gitlab bitbucket git-lfs

我是 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/

相关文章:

没有参数的 Git pull?

git - 本地克隆对 Git 有何影响?

node.js - NodeJS 的 Github 操作 - 本地文件的 'Error: Cannot find module'

git bash "Not a git repository"错误

scala - 如何配置 GitLab CI 作业以运行与 sbt 集成的 Gatling 测试?

linux - Gitlab ce ssh pupkey

gitlab - 如何在特权模式下在本地安装的 gitlab-runner 上使用 docker-in-docker

macos - Git 错误 "fatal: ambiguous argument ' HEAD' : unknown revision or path not in the working tree"

git - 如何从 git 中较新的提交中删除标签?

git - 如何配置命令行 git 使用 ssh key