Skip to content

File Cannot Be Found error #564

Closed

Description

@Leviathan1753

So, we were having git LFS issues on our repo, and decided to give it a fresh go. We made a new repo, copied all our stuff in, uploaded it.

Everything was good to go, we had our master branch with about 6 commits on it. One was all the LFS content, and a few more with some tweaks, including one:
Deleting a DLL file that LFS was tracking.

We commited that deletion, and it was on the master branch.

Now, people cloned, made branches, pushed branches, merged, had a good time.

However, now two of my computers cant push NEW branches to the server. They get an error:
Error uploading file (Path to previous deletion mentioned above) cannot find path specified.

Why is this error cropping up? And why is it complaining about a file that's already been deleted and done with even from before the repo was cloned?

One theory:

  1. The file was deleted, and commited, and pushed to master.
  2. My repo cloned master and went straight to the master tip -> After that file was deleted.
  3. Maybe it didn't actually download that now-deleted file? And now it's complaining?

Either way. Help! I can't push 8(

Activity

  1. technoweenie commented on Aug 5, 2015

    @technoweenie
    Contributor

    Maybe it didn't actually download that now-deleted file? And now it's complaining?

    Yup, that's it. You can fix it like this:

    $ git checkout {sha-before-deleting-file}
    # you should see the smudge filter downloading the file
    $ git checkout branch-to-push
    

    It's an ugly workaround. There are two things that we can do to solve this:

    1. When trying to upload objects, it checks to see if they're on disk at .git/lfs/objects/... first, before checking to see if the server needs it. If we check the server first, it should report that it already includes most of the older files, so that local clones don't need anything.
    2. When pushing a branch, it sends 0000000 as the "before" commit. So it's essentially looking through your entire history just to push the branch. The git lfs pre-push command needs to figure out what the most recent common commit is on the server to trim that down. That way you're not trying to push deleted objects.

    I want at least the first item by v0.6.0. Both definitely by v1.0 though.

  2. Leviathan1753 commented on Aug 5, 2015

    @Leviathan1753
    Author

    EDIT: I see the problem lies with your 2nd point there. A newer branch cares about all the old history, then, and needs all the files (even deleted ones) around in order to push.

    This potentially means that any time we delete a file, it'll cause issues for new cloning users. They'll have to go back and check out (and first find, which would be hellish on a big repo) potentially dozens of various commits where those now-deleted files existed, just to download them into the system so they can push new branches (despite the fact that those branches dont deal with any of those old ancient files)

    Sounds like the best solution would be that smart trimming by finding the common commit with the server, like you mentioned.

    However, in the meantime, is there a way to just mass download ALL files associated with LFS? This would alleviate the need to track down the commits where old files existed. They could just download initially once, and be good to go.

  3. technoweenie commented on Aug 5, 2015

    @technoweenie
    Contributor

    Why is LFS complaining about a previously deleted file when it's just trying to push a new branch that doesn't deal with those files at all? It would make sense if the file was just recently deleted, and was interacting with the some commits that needed some syncing, but in my case, the deleted file was on a commit that was very old; Everyone had already moved past to a commit everyone "agreed" on where it didn't exist.

    It's because Git sends a range of commits to the pre push hook. Git LFS needs to filter out what the remotes already have. Git LFS used to work by tracking an internal queue of objects to push. But sometimes that would get inconsistent, especially if people are rebasing commits. So now it actually analyzes the commit range.

    Is there a way to just mass download ALL files associated with LFS?

    Currently only in master (and eventually v0.6.0+). The fetch command now works more like git fetch, where it simply downloads objects. There's a new checkout command that replaces stuff in the working directory, and a new pull command that combines fetch and checkout.

    Here's a log of me cloning a repo with a deleted file, and downloading it with fetch:

    $ git clone https://github.com/technoweenie/glowing-octo-lana 
    Cloning into 'glowing-octo-lana'...
    remote: Counting objects: 21, done.
    remote: Compressing objects: 100% (3/3), done.
    remote: Total 21 (delta 4), reused 4 (delta 4), pack-reused 14
    Unpacking objects: 100% (21/21), done.
    Checking connectivity... done.
    Downloading droidtocat.gif (24.65 KB)
    Downloading tetsuo.gif (489.49 KB)
    
    $ tree .git/lfs/objects 
    .git/lfs/objects
    ├── 0e
    │   └── c8
    │       └── 0ec81c7b2b505a34126a50297f635d4ef80ca8b37c27d68c9a0da73c92a3770b
    ├── d1
    │   └── c8
    │       └── d1c8fab51418ef587fcf5dd8e73c60b9700704e2f8f5292ea12ec27c285b23a3
    └── logs
    
    5 directories, 2 files
    
    $ git lfs version
    git-lfs/0.5.3 (GitHub; darwin amd64; go 1.3; git 5df23bf)
    # 0.5.3 is wrong, but 5df23bf is the latest commit in master
    
    $ git lfs fetch
    (1 of 3 files) 968.65 KB / 1.45 MB    
    
    $ tree .git/lfs/objects
    .git/lfs/objects
    ├── 0e
    │   └── c8
    │       └── 0ec81c7b2b505a34126a50297f635d4ef80ca8b37c27d68c9a0da73c92a3770b
    ├── d1
    │   └── c8
    │       └── d1c8fab51418ef587fcf5dd8e73c60b9700704e2f8f5292ea12ec27c285b23a3
    ├── f2
    │   └── 30
    │       └── f23095a9b5363f4a914f7094983be213fcc0cc67c0e80cb6fdc0fecce0b2a8f9
    └── logs
    
    7 directories, 3 files
    

    Right now git lfs fetch only operates on the current ref. I also can't guarantee that the fetch command's default behavior will always do this. You can see our current plans for these commands at #490

    Also, I still think this is an ugly workaround. I really like the new fetch command, but I'd like to avoid forcing users to download files they don't need.

    Also, thanks so much for the bug report :)

  4. Leviathan1753 commented on Aug 5, 2015

    @Leviathan1753
    Author

    Yeah, a fetch that gets everything would be "wasteful" for sure, but definitely better than the alternative of failed pushes + needing to track/checkout old stuff to make them function.

    Endgame, whatever the end solution is (smart culling of data past a common commit sounds likely), it should function without needing the user to intervene, in my opinion. I should be able to clone the repo fresh out of the box, make a new branch, and push. If a push fails due to missing a file, I feel like the program should kick into gear and handle it for the user, and then retry the push after any required fetches. Since it's pretty deterministic what should happen (do a fetch), it doesnt really need user intervention.

    Anyway, just babbling, thanks for the response and feedback! 8)

  5. technoweenie commented on Aug 5, 2015

    @technoweenie
    Contributor

    it should function without needing the user to intervene

    I'm giving you ugly workarounds to unblock you. Definitely agreed about this though 🤘

  6. Leviathan1753 commented on Aug 5, 2015

    @Leviathan1753
    Author

    🤘

  7. sinbad commented on Aug 6, 2015

    @sinbad
    Contributor

    This is wider than just deletions too. If at any point a user skips over (never checks out, or fetches in 0.6) a commit which references an oid which then becomes obsolete, e.g. from a modification, then they will never have downloaded that oid. If they then push a branch whose commit range encompasses introducing that binary, it will fail the same way. That will happen even if the 'before' commit for a new branch is made smarter. It's a side effect of the client always being a partial store. The upcoming 'fetch recent' functionality will make it less likely to happen if you use that feature & fetch often but it can still happen.

    So the first item in @technoweenie's list is the one that will fix it: i.e. checking with the server to eliminate things that don't need to be uploaded first because the client won't have everything. The second (finding pushed ancestor as base) just makes things more efficient.

  8. sinbad commented on Aug 10, 2015

    @sinbad
    Contributor

    I need this issue to be fixed in order to support include/exclude filters in fetch (PR #573) - is anyone working on it yet? If not I'll make it my next priority.

  9. technoweenie commented on Aug 10, 2015

    @technoweenie
    Contributor

    @sinbad I haven't started on it, and don't think anyone else has.

  10. sinbad commented on Aug 10, 2015

    @sinbad
    Contributor

    Cool, I'll start investigating tomorrow; it's blocking the rest of my fetch / prune work too.

  11. billygor commented on Aug 11, 2015

    @billygor
    Contributor

    Cool, I'll start investigating tomorrow; it's blocking the rest of my fetch / prune work too.

    @sinbad, please take a look at my take #576 on @technoweenie bullet 2:

    2 When pushing a branch, it sends 0000000 as the "before" commit. So it's essentially looking through your entire history just to push the branch. The git lfs pre-push command needs to figure out what the most recent common commit is on the server to trim that down. That way you're not trying to push deleted objects.

  12. sinbad commented on Aug 11, 2015

    @sinbad
    Contributor

    @sinbad, please take a look at my take #576 on @technoweenie bullet 2:

    Thanks for the heads-up @billygor, I was thinking of tackling the second bullet afterwards as well but won't bother now.

    I'm almost there with fixing this one, currently trying to nail down the error cases & check all the paths (batch/individual).

  13. sinbad commented on Aug 12, 2015

    @sinbad
    Contributor

    This should be fixed by PR #581

  14. technoweenie commented on Aug 17, 2015

    @technoweenie
    Contributor

    Closing this for now. @Leviathan1753 Don't hesitate to reply/reopen if you see the problem in v0.6.x :) Thanks for reporting!

  15. Leviathan1753 commented on Aug 17, 2015

    @Leviathan1753
    Author

    Awesome, thanks guys!

  16. tofutim commented on Jun 13, 2017

    @tofutim

    I'm moving a repo from Bitbucket to Gitlab and ran into the issue where the local repo does not have all the files. However 'git lfs fetch' does not seem to fetch the missing files. Is there a new technique to get everything in preparation for a re-upload?

  17. ttaylorr commented on Jun 13, 2017

    @ttaylorr
    Contributor

    However 'git lfs fetch' does not seem to fetch the missing files.

    It's possible that there are objets not referenced in your working copy that LFS needs in order to execute the push. Could you try git lfs fetch --all instead, and see if that works? If not, please feel free to open a new issue.

  18. tofutim commented on Jun 13, 2017

    @tofutim
  19. ttaylorr commented on Jun 13, 2017

    @ttaylorr
    Contributor

    You can also tell LFS that completing a push without all files is OK via the config option lfs.allowincompletepush.

  20. tofutim commented on Jun 13, 2017

    @tofutim
  21. dakotahawkins commented on Jul 17, 2017

    @dakotahawkins
    Contributor

    @ttaylorr I had this problem today even though I have lfs.allowincompletepush set. Same/similar set-up as OP: LFS file moved and changed a long time ago that I no longer have locally.

    This was with a new branch I was trying to push for the first time. I found I was able to work around the problem by creating the remote branch on the remote, tracking that manually, then pushing.

    It's unclear from the code what's going wrong, but based on the workaround I suspect that maybe LFS thinks it needs to push more refs than it does because the branch is new.

    The unit test for allowincompletepush doesn't look like it would cover this case (unreferenced LFS file missing locally but present on the remote), and based on the test I'm not sure this case should even require an option like allowincompletepush since the missing object doesn't need to be pushed in the first place.

    Do you have any additional ideas or insight? Should I attempt to set up a new (failing) test for this situation and give it to you in a PR?

  22. ttaylorr commented on Jul 24, 2017

    @ttaylorr
    Contributor

    The unit test for allowincompletepush doesn't look like it would cover this case (unreferenced LFS file missing locally but present on the remote), and based on the test I'm not sure this case should even require an option like allowincompletepush since the missing object doesn't need to be pushed in the first place.

    I'm not sure what this would test, either. LFS includes objects in the batch API call based on whether they are referenced in any files in the repository between the refs that it would push. If the server has any of the objects that are included in the batch request, it won't send those objects back in the batch response, meaning the LFS client won't try and find them locally.

    Should I attempt to set up a new (failing) test for this situation and give it to you in a PR?

    👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions