Repository navigation
Description
Description
When installing an R package from a git:: remote (via pak::pak() / pkg_install()) whose repository tracks one or more files with Git LFS (.gitattributes with a filter=lfs entry), the installed package ends up with the raw ~130-byte LFS pointer text file (e.g. version https://git-lfs.github.com/spec/v1\noid sha256:...\nsize ...) in place of the real file content — and pak::pak() reports a normal, successful install, with no warning or error about it.
This happens regardless of whether git-lfs is installed and initialized on the machine (git lfs install run beforehand makes no difference). We confirmed this is because pkgdepends' git:: remote handler uses its own built-in git client rather than shelling out to the system git binary (per the pkgdepends docs: "does not require a system Git installation"). Git LFS is implemented as an external filter (clean/smudge) that only the real git CLI invokes during checkout, driven by config that git lfs install writes to .gitconfig, and by the git-lfs binary itself acting as a filter subprocess. A built-in git client that never shells out to git/git-lfs structurally cannot trigger that filter — so LFS content can never be resolved via this path today, silently.
Reprex
I can't share our internal repo/host, but this reproduces unmodified against a disposable gitlab.com (or github.com) repo:
Setup (one-time)
- Create a throwaway repo, e.g.
youruser/lfstest, with a minimal validDESCRIPTIONat its root (a trivial R package is enough forpakto resolve it). - Track a file with Git LFS and commit/push it:
git lfs install git lfs track "inst/bin/payload" git add .gitattributes head -c 1000000 /dev/urandom > inst/bin/payload # anything non-trivial in size git add inst/bin/payload DESCRIPTION git commit -m "add lfs-tracked payload" git push
Failing case — pak::pak(), even with git-lfs installed
# git-lfs IS installed and initialized on this machine -- doesn't matter
git lfs install
Rscript -e 'pak::pak("git::https://gitlab.com/youruser/lfstest.git")'# after install, inspect what actually landed:
p <- system.file("bin", "payload", package = "lfstest")
file.size(p) # ~130, not ~1000000
readLines(p, n = 1) # "version https://git-lfs.github.com/spec/v1"pak::pak() exits 0 / reports success. No warning is printed about payload being unresolved LFS content.
Non-failing case — a real git clone of the same repo, same machine
git clone https://gitlab.com/youruser/lfstest.git /tmp/lfstest_check
file.size("/tmp/lfstest_check/inst/bin/payload") # ~1000000, correctSame machine, same git-lfs install, same credentials — a real git clone resolves the LFS content correctly; pak::pak() on the identical URL does not.
Expected vs actual behavior
Expected: either (a) git:: remote installs resolve Git LFS pointers to their real content (e.g. via the LFS batch API, which is plain HTTPS and wouldn't require shelling out to the git-lfs binary), or, at minimum, (b) pak::pak()/pkgdepends detects that a required file is an LFS pointer (or that the repo's .gitattributes declares LFS filters) and fails loudly with a clear message, instead of completing the install "successfully" with corrupted content.
Actual: the install silently succeeds and leaves LFS-tracked files as unresolved pointer text, with no indication anything is wrong. This is a correctness footgun: it fails exactly where a user is least likely to notice (a large binary silently becoming a 130-byte text file), and can go unnoticed until whatever consumes that file crashes or misbehaves much later, in an unrelated part of a pipeline.
Environment
- R version: 4.5.x
- pak: latest stable, installed via the official binary channel (
https://r-lib.github.io/p/pak/stable/...) - OS: a recent
rocker/r-ver-based Debian/Ubuntu Docker image (also reproduces outside Docker) git-lfs: tested both absent and present/initialized (git lfs install) — no difference in outcome- Git host: a self-hosted GitLab instance internally; expected (and structurally should, given the built-in-git-client explanation above) to reproduce identically against gitlab.com/github.com per the reprex
Additional context
Searched the r-lib/pkgdepends and r-lib/pak issue trackers for "lfs" before filing and found no existing reports of this.
I understand full LFS support is a larger ask; even just surfacing a warning/error when a pulled file turns out to be an LFS pointer (the pointer format is trivially detectable: a small text file starting with version https://git-lfs.github.com/spec/v1) would turn this from a silent data-corruption trap into a clear, actionable failure.
Activity
gaborcsardi commentedon Sep 14, 2026
We don't use command line
gitand cannot support LFS at this point. So this should be an error.