Skip to content

Installing gems with Git repos containing LFS files does not download LFS files correctly #9612

@karakarasuuuu

Description

@karakarasuuuu

Describe the problem as clearly as you can

When Bundler installs a gem using git:, the process is going to be:

  1. Clone a bare repo from remote in cache
  2. Clone a repo that is gonna be used from the bare one

If the repo uses LFS, then this implementation will be broken, since the repo in 2. will think its LFS server is repo in 1., not the remote one.

Workaround

I've found a related issue in git-lfs/git-lfs#1889, and the solution provided there worked for me, which is explicitly set lfs.url in .lfsconfig. But I think this might be improved in Bundler.

Did you try upgrading rubygems & bundler?

Already tested on:

  1. Ruby 3.1.7 and Bundler 2.6.3 on Windows
  2. Ruby 4.0.5 and Bundler 4.0.10 on Linux

Neither of them worked.

Post steps to reproduce the problem

  1. Add a gem containing LFS files with git url like gem 'XXX', git: '{git url}'
  2. Run bundle install

Which command did you run?

bundle install

What were you expecting to happen?

The installation succeeds.

What happened instead?

Sensitive information in the following command output has been replaced with meaningful texts surrounded by curly brackets.

Fetching {a git url}
Git error: command `git reset --hard 7cfbe226c488b6b291cff2394fdbec6e1c38c9ec` in directory
{the git repo 2. mentioned above}
has failed.
Downloading {the filename of a LFS file} (164 KB)
Error downloading object: {the filename of a LFS file} (5a424d7): Smudge error: Error downloading
{the filename of a LFS file} (5a424d7af555174a55872a454fd1665d7e635c510027a3233bec94830e79ac57): error
transferring "5a424d7af555174a55872a454fd1665d7e635c510027a3233bec94830e79ac57": [0] remote missing object
5a424d7af555174a55872a454fd1665d7e635c510027a3233bec94830e79ac57

Errors logged to
{the file path of the log file}.
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: {the filename of a LFS file}: smudge filter lfs failed

If not included with the output of your command, run bundle env and paste the output below

Environment

Bundler       4.0.10
  Platforms   ruby, x86_64-linux
Ruby          4.0.5p0 (2026-05-20 revision 64336ffd0ee9e1f4c05891695a3d7b49cb709721) [x86_64-linux]
  Full Path   {home directory}/.rbenv/versions/4.0.5/bin/ruby
  Config Dir  {home directory}/.rbenv/versions/4.0.5/etc
RubyGems      4.0.10
  Gem Home    {home directory}/.rbenv/versions/4.0.5/lib/ruby/gems/4.0.0
  Gem Path    {home directory}/.local/share/gem/ruby/4.0.0:{home directory}/.rbenv/versions/4.0.5/lib/ruby/gems/4.0.0
  User Home   {home directory}
  User Path   {home directory}/.local/share/gem/ruby/4.0.0
  Bin Dir     {home directory}/.rbenv/versions/4.0.5/bin
Tools
  Git         2.54.0
  RVM         rvm-windows does only run on windows platforms!
  rbenv       rbenv 1.3.2
  chruby      not installed

Bundler Build Metadata

Timestamp  2026-06-11
Git SHA    unknown

Bundler settings

{private GitLab url}
  Set for the current user ({home directory}/.bundle/config): "{username}:[REDACTED]"

Gemfile

Gemfile

gem '{the name of the gem}', git: '{the git url}', tag: '0.4.0'

Gemfile.lock

<No {home directory}/test-latest-bundler/Gemfile.lock found>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions