git lfs migrate import --no-rewrite 未知标志 --no-rewrite

git lfs migrate import --no-rewrite unknown flag --no-rewrite

我正在尝试使用 git lfs migrate import --no-rewrite 修复丢失的指针问题,首先我使用 git reset --hard:

列出所有丢失指针的文件
new Promise((resolve, reject) => {
    exec("git reset --hard", (error, stdout, stderr) => {
        if (error) {
            console.error(`exec error: ${error}`);

            reject(error);
            return;
        }

        const filesWithMissingPointers = Array.from(
            stderr.matchAll(/\t(.*)/g)
        ).map((m) => m[1]);

        resolve(filesWithMissingPointers);
    });
});

然后我记录输出:

console.log(
    `Problem files before lfs migrating: \t\n${problemFilesBefore.join("\t\n")}`
);

输出:

Problem files before lfs migrating:     
IdleGame/Assets/Plugins/Fonts/Localization/Korean/NotoSansCJKkr-Medium.otf  
IdleGame/Assets/Plugins/Fonts/Localization/Latin_Cyrillic_Greek/OctoberPro-Black.otf    
IdleGame/Assets/Plugins/Fonts/Localization/Latin_Cyrillic_Greek/OctoberPro-HeavyItalic.otf  
IdleGame/Assets/Plugins/Fonts/Localization/Persian/NotoNaskhArabicUI-Bold.ttf   
IdleGame/Assets/Plugins/Fonts/Localization/Thai/NotoSansThaiUI-CondensedMedium.ttf  
IdleGame/Assets/Plugins/Fonts/Oswald-Bold.ttf   
IdleGame/Assets/Plugins/Fonts/PoetsenOneRegular/TrueType font file/PoetsenOne-Regular 1.ttf 
IdleGame/Assets/Plugins/Fonts/Roboto Medium/TrueType font file/roboto-medium.ttf    
IdleGame/Assets/Plugins/Fonts/nevis.ttf 
IdleGame/Assets/Plugins/LibrariesDesign/BeautifulDissolves/_Examples/_Assets/Textures/ZomBearSpecular.tif   
IdleGame/Assets/Plugins/LibrariesDesign/BeautifulDissolves/_Examples/_Assets/Textures/ZomBunnySpecular.tif

然后我会尝试 运行:

execSync(
  `git lfs migrate import --no-rewrite \ -m "AutoCommit Bot: fix missing LFS points ${process.env.CI_PIPELINE_URL}" ${problemFilesBefore.join(" ")} --yes`
);

我遇到了:

Error: unknown flag: --no-rewrite

我在 运行 在 powershell 中使用命令时在本地遇到同样的问题,但在 运行 在 bash 中使用命令时我没有遇到它。我的脚本 运行s 在 docker 容器 (linux) 中,安装了 git lfs。因为它是 Unix,所以它应该使用 bash 作为默认命令行,所以我不认为问题出在 shell.

注意:我 运行 这个脚本是 gitlab

上的作业

--no-rewrite 标志在 Git LFS 2.3.4 中不可用。 Git LFS 有一个相当积极的发布过程,因此在版本之间添加了许多新功能,通常每 3 个月发布一次。

如果您使用的是 Ubuntu 18.04,您可能需要升级到 20.04,或者至少使用更新的版本。 Git LFS 项目提供了额外的二进制文件和软件包,如果您不方便升级 OS。

如果您正在使用 Windows 进行某些操作,您应该将 Git 的版本升级为 Windows。 Git Git Windows 的 LFS 随附 Git,获得更新版本的最简单方法是升级 Git。在那里手动安装更新版本很棘手,因为很难覆盖 built-in 版本。