Trying to migrate a repo (including history) OUT of Git LFS.
I ran git lfs migrate export --include="*" --everything
(mentioned here) on a test repo, but it didn't work as expected and left LFS pointer files instead of converting them all to objects.
I tried alternative methods, following this. Unfortunately it still left pointer files, so I combined it with this.
In the end, I even ran all the commands together:
git lfs uninstall
git filter-branch -f --prune-empty --tree-filter '
git lfs fetch
git lfs checkout
git lfs ls-files | cut -d " " -f 3 | xargs touch
git lfs ls-files | cut -d " " -f 3 | xargs git rm --cached
git rm -f .gitattributes
git lfs ls-files | cut -d " " -f 3 | xargs git add --force
git add --renormalize .
' --tag-name-filter cat -- --all
Didn't work. Gave me the following error for multiple files, and the filtered commits have pointer files instead of the objects.
Errors logged to <PATH>
Use `git lfs logs last` to view the log.
Rewrite <COMMIT SHA ####> (2/9) (2 seconds passed, remaining 7 predicted)
Checking out LFS objects: 0% (0/1), 0 B | 0 B/s
Checking out LFS objects: 100% (2/2), 3.1 KB | 0 B/s, done
Error updating the git index:
error: picture.png: cannot add to the index - missing --add option?
fatal: Unable to process path picture.png
I tried running the same commands on only the tip commit, and it seems like touch
, rm --cached
, add --renormalize .
, add --force
don't show any modifications with git status
. So I'm unable to re-add the cleaned/pulled object files to a new commit.
Maybe that's the problem? So how to forcibly re-add unchanged file to index when using filter-branch?
(Using Windows with git bash.)