7

I have been given an old repository with LFS but some of the (probably older) files are missing so I cannot push:

git push -u origin
Locking support detected on remote "origin". Consider enabling it with:
  $ git config lfs.https://gitlab.com/gitlabaccount/repo.git/info/lfs.locksverify true
Unable to find source for object 43cb9e6d1d15bb8d31af911aa69a15a67174c5 (try running git lfs fetch --all)                                                                                                                                           
Uploading LFS objects:  87% (600/691), 546 MB | 0 B/s, done
error: failed to push some refs to 'git@gitlab.com:gitlabaccount/repo.git'

My colleague allegedly ran git lfs fetch --all and it did not fix the problem.

I would really just like a copy of the latest, all history, and a build that works now. I'm not really worried about the older files and my preference would be to complete the push and lose a few missing lfs files but the lfs error will not let me.

Gitlab would allow me to disable lfs on the project but I dont know what will happen to the size/limits if I do this. Not sure what would be the proper procedure to enable then disable it on the server or the client. Alternatively, is there a "ignore missing files" option for the push?

Steve
  • 3,957
  • 2
  • 26
  • 50
  • 1
    I don't think you can disable this check. You'll have to rewrite the history of the project not to contain those LFS pointers if you don't have the files for them. – bk2204 Aug 08 '19 at 23:30
  • @bk2204 I have identified the file as one that comes and goes in prior commits but is not present at the present one by using bitbucket's `for i in `ls`;do echo $i; cd $i; git log --all -p -S 43cb9e6d1d15bb8d31af911aa69a15a67174c5; cd -;done`. Is something like `git filter-branch --force --tree-filter 'rm -f path/to/big_file.mpg' HEAD` sufficient? (https://community.atlassian.com/t5/Bitbucket-questions/Delete-Git-LFS-files/qaq-p/863172) – Steve Aug 09 '19 at 19:26
  • 1
    If all of the missing LFS objects are instances of that path, then yes, that should be sufficient if you replace `HEAD` with `--all`. – bk2204 Aug 09 '19 at 20:54
  • @bk2204 Note that the replacement should probably be `HEAD` for `-- --all`. Also, in this case there are apparently multiple files this fails. My thought is to add the new paths to the `rm -f file1 file2 file3` command – Steve Aug 09 '19 at 23:56

1 Answers1

8

You can ignore it using below, it will ignore pre-push hook of git lfs

git push --no-verify
Jijo John
  • 1,368
  • 2
  • 17
  • 31