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 8 years ago
- Reactions: 14
- Comments: 25 (12 by maintainers)
Commits related to this issue
- Add .lfsconfig to work around SwiftPM bug (#685) **Public-Facing Changes** None **Description** Attempted workaround for https://forums.swift.org/t/swiftpm-with-git-lfs/42396/4 / https://github.... — committed to foxglove/mcap by jtbandes 4 years ago
- Uninstall LFS as it is not supported by SPM see https://github.com/apple/swift-package-manager/issues/5351 — committed to ruuvi/BTKit by rinat-enikeev 3 years ago
- Uninstall LFS as it is not supported by SPM (#14) see https://github.com/apple/swift-package-manager/issues/5351 — committed to ruuvi/BTKit by rinat-enikeev 3 years ago
Can we get an update on this please? It’s been open for 6 years but seems like a critical barrier preventing 100% adoption of Swift PM.
Is there any update to this?
The workaround from @briancordanyoung seem to work, but the Xcode path has changed
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
+1
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
xcodebuildin CI (but not the Xcode app): https://github.com/foxglove/MCAPSpotlightImporter/actions/runs/3380647041/jobs/5613664270However, the .lfsconfig file is causing some other issues for developers working with the repo… 😓
Based on this thread and the forum discussion, I came to the same blocking errors.
Linking git-lfs did work in the sense that Xcode used it but reported a different error downloading various files that were checked in with lfs. The error included “Smudge error: Error downloading…”
Adding a .lfsconfig (with an updated path for my repo) did not help with me when running
swift buildor an Xcode package resolution. I did have some GitHub authentication errors until I removed the commit that added the file.The only work around I have is to manually clone the repo and include it as a local package—which of course negates all advantages of using a dependency manager. 😫
I did file FB11803523 for Xcode.
Thanks, this helps!