Search code examples
gitgit-lfsbfg-repo-cleaner

Unable to convert git repo to use large file support (lfs) via the bfg tool


I am trying to convert an existing git repo to use git lfs. I am following Atlassian's recipe, using the BFG tool here: https://rtyley.github.io/bfg-repo-cleaner/

The problem is that when I issue the suggested command to do the actual conversion, it ends almost immediately with no actual work done:

C:\src> java -jar bfg-1.12.15.jar --convert-to-git-lfs '*.{msi,7z,gz,zip,bin,exe,psd,pdf}' --no-blob-protection ent.git`

Using repo : C:\\src\\ent.git

Found 0 objects to protect
Found 35 tag-pointing refs : refs/tags/4.2/4.2.0, refs/tags/4.2/4.2.1, refs/tags/4.2/4.2.2, ...
Found 145 commit-pointing refs : HEAD, refs/heads/ESP-1652-filetransformer-throws-system.invalidoperationexception, refs/heads/archive/cmdev, ...

Protected commits
-----------------

You're not protecting any commits, which means the BFG will modify the contents of even *current* commits.

This isn't recommended - ideally, if your current commits are dirty, you should fix up your working copy and commit that, check that your build still works, and only then run the BFG to clean up your history.

Cleaning
--------

Found 11182 commits
Cleaning commits:       100% (11182/11182)
Cleaning commits completed in 782 ms.

BFG aborting: No refs to update - no dirty commits found??

I am on Windows 10 btw. Using git version 2.9.2.windows.1.

Any ideas?


Solution

  • I found the problem. The BFG tool needs to have double-quotes in the arguments. Not single-quotes as in the Atlassian sample. Perhaps an issue for Windows only?

    FYI: The working command is then:

    java -jar bfg-1.12.15.jar --convert-to-git-lfs "*.{msi,7z,gz,zip,bin,exe,psd,pdf}" --no-blob-protection ent.git