如何从使用 LFS 的 GIT 存储库中删除无效条目(或指针)?

How can I remove invalid entries (or pointers) from a GIT reposiory that uses LFS?

我们使用 git lfs 在 git 存储库中添加了一些 png。不知何故出了点问题,一些文件有错误的斜杠条目

data/images\picture1.png
data/images\picture2.png

真正的文件存在并且工作正常

data/images/picture1.png
data/images/picture2.png

现在如果我拉,我会得到一个错误

$ git.exe pull --progress --no-rebase -v "origin"
From bitbucket.org:USER/REP
= [up to date]      master     -> origin/master
Pointer file error: Unable to parse pointer at: "data/images\picture1.png"

我已经试过 git rm 和 gc 但没有成功。有没有办法直接从 git 数据库中删除这些条目?

问题在 Windows、Linux 和 Mac

编辑

运行 git ls-files,我可以看到列表中的文件,类似于

  data/images/picture0.png
  "data/images\picture1.png"
  "data/images\picture2.png"
  data/images/picture3.png

如果我尝试 git rm 各种风格(引号、不引号、--force、--cache、--dry-运行),我总是收到错误

fatal: pathspec '"data/images\picture1.png"' did not match any files

我们最终从头开始创建存储库,问题自行消失了。这可能是由于目前影响 git LFS 的众多问题之一..