GitLab推送错误:缺少LFS对象 [英] GitLab push error: LFS objects are missing

查看:1749
本文介绍了GitLab推送错误:缺少LFS对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在GitLab上使用Git LFS几个月了,没有任何问题,但是最近推送文件时它返回了以下错误:

I've used Git LFS for GitLab for a few months now without any problems, but it returned the following error while pushing files lately:

$ git push origin master
Git LFS: (14 of 14 files) 8.88 MB / 8.88 MB
Counting objects: 54, done.
Delta compression using up to 6 threads.
Compressing objects: 100% (49/49), done.
Writing objects: 100% (54/54), 5.42 KiB | 0 bytes/s, done.
Total 54 (delta 15), reused 0 (delta 0)
remote: GitLab: LFS objects are missing. Ensure LFS is properly set up or try a manual "git lfs push --all".
To https://gitlab.com/<gitURL>.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://gitlab.com/<gitURL>.git'

其中 gitURL 是我的git存储库URL.

where gitURL is my git-repository URL.

由于错误提示,我尝试使用 git lfs push --all 手动推送二进制文件,这将为我提供以下输出:

As the error suggests I tried to manually push my binary files, using git lfs push --all, which gives me the following output:

$ git lfs push --all origin master
Git LFS: (0 of 0 files, 1370 skipped) 0 B / 0 B, 1.77 GB skipped

根据我的理解,这意味着我的所有本地文件已经成功存储在服务器上.

which means by my understanding that all my local files are already successfully stored on my server.

尝试获取所有lfs文件也可以正常工作:

Trying to fetch all lfs files does work fine as well:

$ git lfs fetch --all
Scanning for all objects ever referenced...
* 1446 objects found
Fetching objects...

完成时没有任何错误.

此外,使用 git lfs fsck 检查所有lfs文件的一致性似乎也可以:

Moreover checking all lfs files for consistency using git lfs fsck seems to work fine too:

$ git lfs fsck
Git LFS fsck OK

我开始的想法对,现在修复此错误的冒了出来.任何帮助将不胜感激.

I'm starting to run out of ideas about fixing this error now. Any help would be greatly appreciated.

推荐答案

最近在GitLab上的我们的存储库中引入了自己的LFS支持时,就发生了这种情况.如果您想继续使用自己的LFS,那么过程会很痛苦-您需要在每个存储库上禁用其自己的LFS支持,但是似乎没有针对它的Web选项,您需要通过他们的命令行API:

This happened to our repositories on GitLab when they introduced their own LFS support recently. If you want to continue to use your own LFS then the process is rather painful - you need to disable their own LFS support on each repository, but there doesn't seem to be a web option for it, you need to do it via their command line API:

  1. 安装python gitlab命令行API: pip install python-gitlab
  2. 为您的帐户设置一个私有gitlab令牌,并在您的帐户配置文件的访问令牌"部分中生成该令牌.
  3. 将配置文件写到〜/.python-gitlab.cfg :

[global]
default = yourrepo
ssl_verify = true
timeout = 20

[yourrepo]
url = https://gitlab.com/
private_token = <your API key from the settings tab on gitlab.com>

  • 抓住从设置网页的顶部您gitlab项目ID

  • Grab your gitlab project id from the top of the settings web page

    我们的一些开发人员报告说,即使这样也不起作用,他们不得不求助于向 https://gitlab.com/api/v4/projects/<您的项目ID>发送手动HTTP PUT请求.;?lfs_enabled = false ,并且将Private-Token标头设置为您的私人令牌.例如,使用CURL:

    Some of our developers reported that even this didn't work and they had to resort to sending a manual HTTP PUT request to https://gitlab.com/api/v4/projects/<Your project id>?lfs_enabled=false with a Private-Token header set to your private token. For example, with CURL:

     curl -X PUT --header "Private-Token: <private token>" -F "lfs_enabled=false" https://gitlab.com/api/v4/projects/<project id>
    

    这篇关于GitLab推送错误:缺少LFS对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆