gpt4 book ai didi

GitLab 推送错误 : LFS objects are missing

转载 作者:太空狗 更新时间:2023-10-29 13:19:09 40 4
gpt4 key购买 nike

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

$ 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-repository URL。

正如错误提示的那样,我尝试使用 git lfs push --all 手动推送我的二进制文件,这给了我以下输出:

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

这意味着我的所有本地文件都已成功存储在我的服务器上。

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

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

完成时没有任何错误。

此外,使用 git lfs fsck 检查所有 lfs 文件的一致性似乎也能正常工作:

$ git lfs fsck
Git LFS fsck OK

我现在开始想不出修复这个错误的想法了。任何帮助将不胜感激。

最佳答案

最近 GitLab 上的存储库引入了自己的 LFS 支持时,就发生了这种情况。如果你想继续使用你自己的 LFS 那么这个过程是相当痛苦的 - 你需要在每个存储库上禁用他们自己的 LFS 支持,但似乎没有一个 web 选项,你需要通过他们来做命令行 API:

  1. 安装 python gitlab 命令行 API:pip install python-gitlab
  2. 为您的帐户设置一个私有(private) gitlab token ,在您帐户配置文件的访问 token 部分生成它。
  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>
  4. 从设置网页的顶部获取您的 gitlab 项目 ID

  5. gitlab project update --lfs-enabled false --id <Your project id>

我们的一些开发人员报告说,即使这样也行不通,他们不得不向 https://gitlab.com/api/v4/projects/<Your project id>?lfs_enabled=false 发送手动 HTTP PUT 请求。将 Private-Token header 设置为您的私有(private) token 。例如,使用 CURL:

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

关于GitLab 推送错误 : LFS objects are missing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47379344/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com