Skip to content

Git LFS doesn't appear to be working #511

@stonesbg

Description

@stonesbg

🔧 Summary

We have lfs setup on our environments and after installing the lefthook hooks it replaces the git lfs hooks. From the documentation it lefthook does support lfs and if I turn on verbose I can see it try to execute lfs but not sure if there is secret sauce in the lfs hooks but every push doens't include the lfs file upload.

I have tried both wsl2 and windows and both behave the same. If I remove the lefthook pre-push hooks and re-instate the lfs ones using git lfs update --force. If i push then i can see that the lfs update has triggered.

The only thing I can think of is that potentially would be different execution environment between the two. I noticed that the hook uses git-lfs and the lefthook call uses git lfs. Lastly I also noticed in the hook for windows it does a unset GIT_PREFIX; ssh git@bitbucket.org 'git-receive-pack '\''brian_garvey/lfs-lefthook-test.git'\'''

Here is the test repo LFS Lefthook Test. I tried to keep it simple.

Lefthook version

lefthook -> 1.4.3
git -> 2.41.0
git-lfs -> 3.0.2 (WSL 2) & 3.3.0 (windows)

Steps to reproduce

  1. Copy JPG File to directory
  2. Install the lefthook hooks lefthook install -a
  3. Run git add . and git commit -m 'message'
  4. Rung git push

Expected results

LFS images are pushed to the remote repository and and subsequently pull them down

Actual results

Check bitbucket UI and see that images are not loading and external pull shows 404 errors for the lfs files

Logs / Screenshots

git hook version

trace git-lfs: pure SSH protocol connection failed: Unable to negotiate version with remote side (unable to read capabilities): EOF
trace git-lfs: pre-push: refs/heads/master a92e62630365e8950c18a69b83ab8c141f97a4d8 refs/heads/master eee5ea60a973bde0729800020680bfd928d6be24
trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'show-ref'
trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'ls-remote' '--heads' '--tags' '-q' 'origin'
trace git-lfs: tq: running as batched queue, batch size of 100

lefthook version

trace git-lfs: pure SSH protocol connection failed: Unable to negotiate version with remote side (unable to read capabilities): EOF
trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'show-ref'
trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'ls-remote' '--heads' '--tags' '-q' 'origin'
trace git-lfs: filepathfilter: creating pattern ".git" of type gitignore

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions