GitLab push error: LFS objects are missing

前端 未结 2 870
遇见更好的自我
遇见更好的自我 2021-02-06 11:07

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         


        
相关标签:
2条回答
  • 2021-02-06 12:06

    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. Install the python gitlab command line API: pip install python-gitlab
    2. Setup a private gitlab token for your account, generate it on the Access Tokens portion of your account profile.
    3. Write a configuration file out to ~/.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. Grab your gitlab project id from the top of the settings web page

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

    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>
    
    0 讨论(0)
  • 2021-02-06 12:09

    This command helped me:

    git lfs ls-files -l | awk '{ print $1 }' | xargs git lfs push --object-id origin
    

    And it is faster than the other answer.

    0 讨论(0)
提交回复
热议问题