Mirrored project with LFS files returns Object does not exist on the server or you don't have permission to access it.

Summary

  • Pull mirroring repositories between 2 GitLab instances, and clone the project from remote GitLab instance (mLTS enabled)
  • After the mirroring is done, clone the repo and it returns LFS error with Object does not exist on the server or you don't have permission to access it error

image.png

Reproduction steps (by @vyaklushin)

Setup

  1. Create a new project (ProjectA)
  2. Clone this project locally
  3. Enable LFS tracking for .text files (git lfs track '*.text')
  4. Create a lfs.text file (echo 'Test' > lfs.text)
  5. Add and commit new file
  6. Push file to the repository
  7. You should see LFS label next to it Screenshot_2023-08-21_at_10.11.02

Reproduction

  1. Create a new empty project (ProjectB)
  2. Setup pull mirroring for it Screenshot_2023-08-21_at_10.12.31
  3. Clone ProjectB locally
  4. You should see an error
Receiving objects: 100% (13/13), done.
Resolving deltas: 100% (1/1), done.
Downloading lfs.text (9 B)
Error downloading object: lfs.text (c418342): Smudge error: Error downloading lfs.text (c4183428d5cb2d6f86de19005bcd4643ac8e18284dcb641b5d8d075cc3ceb52f): [c4183428d5cb2d6f86de19005bcd4643ac8e18284dcb641b5d8d075cc3ceb52f] Object does not exist on the server or you don't have permissions to access it: [404] Object does not exist on the server or you don't have permissions to access it

Errors logged to '.../.git/lfs/logs/20230821T100647.784524.log'.
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: lfs.text: smudge filter lfs failed
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

Root cause

I noticed that LfsObjectsProject record for the new project was missing. Basically, we didn't link LFS files to ProjectB.

After I manually fixed it the in database, I was able to clone the repository without any problems.

Edited by Vasilii Iakliushin