swift-package-manager: [SR-8262] Swift Package Manager fails at checkout when dependent repository contains Git LFS objects

Previous ID SR-8262
Radar rdar://problem/42246102
Original Reporter yifei (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 2
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 2218c2c1d09b919e983b204e24d25058

Issue Description:

The error is in the format of: (XXXXX being the name of LFS-tracked file)

Error downloading object: XXXXX (hash): Smudge error: Error downloading XXXXX (hash): batch request: missing protocol: "/path/to/project/.build/repositories/dependency.git/info/lfs"

error: external filter 'git-lfs filter-process' failed
fatal: XXXXX: smudge filter lfs failed
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

This happens during the “cloneCheckout” phase i.e. invoking “git clone --shared”. If I disable the LFS filter by editing the global .gitconfig, the project builds fine.

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 7
  • Comments: 23 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Is there any update to this?

The workaround from @briancordanyoung seem to work, but the Xcode path has changed

cd /Applications/Xcode.app/Contents/Developer/usr/bin
ln -s /opt/homebrew/bin/git-lfs git-lfs

One option for this I wrote up here (which only applies if the LFS files are something optional for your package, like test results): https://stackoverflow.com/questions/67457594/swift-package-manager-does-not-work-with-git-lfs/77336212#77336212

Not sure if it helps you, but I believe the .lfsconfig file has to be present on the repo’s default branch. When SPM clones the package it starts with the default branch and then checks out whichever branch/commit you requested.

This did ultimately end up working well enough for me, I was able to use xcodebuild in CI (but not the Xcode app): https://github.com/foxglove/MCAPSpotlightImporter/actions/runs/3380647041/jobs/5613664270

However, the .lfsconfig file is causing some other issues for developers working with the repo… 😓

Thanks, this helps!