Rufous

Force pushes can lead to "bad object" message from git rev-list · Issue #3977 · git-lfs/git-lfs

Format: markdownScore: 10Link: https://github.com


            
  

  

          

  
    
    New issue
  
  
            
  
    Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
  

  

  By clicking “Sign up for GitHub”, you agree to our terms of service and
  privacy statement. We’ll occasionally send you account related emails.

  
    Already on GitHub?
    Sign in
    to your account
  

  

        
      

  
    
  
  Closed

    

      


      

    
        bk2204  opened this issue
Jan 10, 2020
· 23 comments


   · Fixed by #4102


    
  





    
    



            

                            
Comments

      

  



  

        

          Describe the bug
When force-pushing a ref to a remote, if the object the remote side's ref points to is not in the local copy, we'll abort with a message like the following:
ref temp:: Error in git rev-list --stdin --objects --not --remotes=origin --: exit status 128 fatal: bad object ae86523521e10b0e8aa3c50dda910064ec2ff155

Expected behavior
We don't abort in this case and simply skip using that object.
System environment
Debian sid, Git LFS master
      



        
  
    
      
    
          williamtheaker, wi1dcard, AdamDomagalsky, thibaut-pro, vergilcastelo, danyaljj, hustCYQ, IvanNovoselov, dzmitry-lahoda, hhe, and aloshiousraju reacted with thumbs up emoji
      
    

      




      
    


      

  




  

        

          hello,
while trying to push (not forced), i got this error. how can i fix it?
thanks
      



        
      




      

  




  

        

          You can run git fetch to fetch from the remote first.
      



        
  
    
      
    
          vastopa, lucasrangit, wedigitizeu, xissburg, suryaavala, artemgordinskiy, netphantom, itsho, PereMassaguer, pravkuma, and 83 more reacted with thumbs up emoji
          real-human-male reacted with thumbs down emoji
          JVerma205, pbhoiwala, PeterMitrano, mostafa-ibm, iranimij, krunalkumarsolanki, surya-narayanan, hhe, and eunjung31 reacted with hooray emoji
      
    

      




      
    
  wi1dcard 

      added a commit
        to wi1dcard/blog
      that referenced
      this issue

    
      Feb 22, 2020
    
    
  
        
  

  

      

  




  

        

          Hello. Is there any workaround for this issue?
      



        
      




      

  




  

        

          Yes. Try reading the comment before yours.
      



        
  
    
      
    
          AntonioL, sohamm17, danielhardej, hhe, and markovalexander reacted with thumbs up emoji
          real-human-male and cajubelt reacted with thumbs down emoji
          nijk, delimatorres, ianfhunter, pjboro, kezzyhko, DavyDebacker-TomTom, AntonioL, kethansrinivas9, ermilindwalekar, ykarmesh, and 11 more reacted with laugh emoji
          lswidere, acocamitiga, and hhe reacted with hooray emoji
          kezzyhko reacted with rocket emoji
      
    

      




      
  
          

    
  wi1dcard 

      added a commit
        to wi1dcard/blog
      that referenced
      this issue

    
      Feb 23, 2020
    
    
  
        
  

  

  

    
  wi1dcard 

      added a commit
        to wi1dcard/blog
      that referenced
      this issue

    
      Feb 23, 2020
    
    
  
        
  

  

  

    
  wi1dcard 

      added a commit
        to wi1dcard/blog
      that referenced
      this issue

    
      Feb 23, 2020
    
    
  
        
  

  





      

  




  

        

          @slonopotamus Thank you, it works! I thought that was a solution who didn't perform a force push.
      



        
      




      
    
  wi1dcard 

      added a commit
        to wi1dcard/blog
      that referenced
      this issue

    
      Feb 23, 2020
    
    
  
        
  

  

      

  




  




      

  




  

        

          Hey,
I've provided a workaround above.  Please see my last comment.
      



        
      




      

  




  

        

          Hey,
I am getting the error and I can't seem to understand what is the workaround. I do fetch first, but when I do... I still have the 1.7GB folder and I have to through all the lfs initialization again
      



        
      




      

  




  

        

          Hey,
There shouldn't be a need to re-initialize anything after fetching.  You should just be able to push and things should work.  If you're seeing an error about something other than git rev-list, then the error you're seeing is different than this one, so please open a new issue so we can help out.
      



        
      




      

      

  




  

        

          
Describe the bug
When force-pushing a ref to a remote, if the object the remote side's ref points to is not in the local copy, we'll abort with a message like the following:
ref temp:: Error in git rev-list --stdin --objects --not --remotes=origin --: exit status 128 fatal: bad object ae86523521e10b0e8aa3c50dda910064ec2ff155

Expected behavior
We don't abort in this case and simply skip using that object.
System environment
Debian sid, Git LFS master

Hey I was trying this
git push -u origin master -f
ref master:: Error in git rev-list --stdin --objects --not --remotes=origin --: exit status 128 fatal: bad object 37e7a1a3bc6a54fc4ea2c0e466275858e6da8286
but I got this error can you help me how to solve it
      



        
      




      

  




  

        

          If you read the third comment in the issue, I explain how to solve it.  There's also an outstanding PR to fix this which is waiting on CI to be fixed.
      



        
      




      

  




  

        

          Hey
Can you elaborate steps cuz I didn't get it
Thanks in advance
      



        
      




      

  




  

        




        
  
    
      
    
          kromar, bravetroop, hinell, LMojica, tcostam, rajkumarmahanta123, talyal, arslan77, JakeHaitsma, raj-chinagundi, and 8 more reacted with thumbs down emoji
      
    

      




      

      

  




  

        

          I'm not sure if this is related, but I have this error on repository on in Fork (Window). When opening a terminal window git push works as expected. I use git version 2.26.2.windows.1.
      



        
      




      

  




  

        

          @pixtur If you're still seeing this with the latest version of Git LFS, could you please open a new issue with reproduction steps?
      



        
      




      

  




  

        

          Updating git (from 2.26) and git-lfs (from 2.10.0) to git scm 2.29.2 solved my issue.
      



        
      




      

  




  

        

          [root@www gitlfs_test]# git push origin main
batch response: Post http://192.168.200.103/root/gitlfs_test.git/info/lfs/objects/batch: dial tcp 192.168.200.103:80: connect: connection refused
error: 无法推送一些引用到 'ssh://git@192.168.200.103:7003/root/gitlfs_test.git'
After installing git LFS, I want to track large files and report an error when uploading them. Which God can help answer it? Thank you
      



        
      




      

  




  

        

          Hey,
This says that your LFS server is not running or not responding, or the firewall has blocked it.  If you need help, please open a new discussion.
      



        
      




      

  




  

        

          
@sakshijain032:

You can run git fetch to fetch from the remote first.


Just to expand a bit, I ran git fetch origin <remote_branch_name>. Then I ran git push --force, and it seems to solve my issue.
      



        
      




      

  




  

        

          I'm getting the rev-list error, but when I try to fetch as has been recommended multiple times in this thread, I get the following error:
$ git fetch origin main

remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
fatal: bad object dc73db0cd224d6bf66c4bbf3a20b8495cee23ff6
error: github.com:kenlefeb/repo.git did not send all necessary objects

ChatGPT suggested I use git fsck to do a repair, but that didn't have any noticeable effect, and I'm in over my head with this issue. :) Do you have any recommendations for next actions?
      



        
      




      

  




  

        

          That sounds like more of a Git problem, and for whatever reason, your Git version thinks GitHub didn't send all the Git objects needed.  It would be best if you contacted GitHub Support about that, since there's nothing that we can do about Git problems here.
      



        
      




      

  




  

        

          OK, thanks. I'm lucky that my history is not very important, so I might just delete the repo and create a new one from the working directory, to try again. That'll make my LFS cleaner, anyway, since I didn't install LFS until after I'd already stuck a bunch of large files into the local repo, so I was filter-branching them out of my local history and I must have done something wrong and screwed up my repo.
Thanks again; I appreciate how quick you were to respond too!
      



        
      




      
    
  github-actions bot

      pushed a commit
        to veloren/veloren
      that referenced
      this issue

    
      Aug 4, 2023
    
    
  
  
        
  

    
      ….com/veloren/veloren/-/jobs/4749826609

$ if [[ ! "${SCHEDULE_CADENCE}" =~ ${TAG_REGEX} ]]; then # collapsed multi-line command
warning: redirecting to https://gitlab.com/veloren/veloren.git/
Locking support detected on remote "origin". Consider enabling it with:
  $ git config lfs.https://veloren-bot:[MASKED]@gitlab.com/veloren/veloren.git/info/lfs.locksverify true
ref weekly:: Error in git rev-list --stdin --objects --not --remotes=origin --: exit status 128 fatal: bad object 11bc48033cf4e6528268f2acd97324e16e118bce
error: failed to push some refs to 'https://veloren-bot:[MASKED]@gitlab.com/veloren/veloren'

There seems to be a fix proposed here: git-lfs/git-lfs#3977 by running git fetch first.
lets try it out. Maybe we need to give it some commandline parameters to optimize in the future
    

  



        

  




  

        

          Hello!
I had this same issue.
Error in git rev-list --stdin --objects --: exit status 128 fatal: bad object xxxxx
I tried --force, git push origin xxxxx -f, without success.
To solve it I just ran:
git pull origin <your_origin_branch>
Then I pushed again and it's worked.