I'm trying to fix missing pointers issue using git lfs migrate import --no-rewrite
first i list all the files that had missing pointers using 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);
});
});
Then i log the output:
console.log(
`Problem files before lfs migrating: \t\n${problemFilesBefore.join("\t\n")}`
);
Output:
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
I'm then trying to run:
execSync(
`git lfs migrate import --no-rewrite \ -m "AutoCommit Bot: fix missing LFS points ${process.env.CI_PIPELINE_URL}" ${problemFilesBefore.join(" ")} --yes`
);
And i encounter:
Error: unknown flag: --no-rewrite
I'm encountering the same issue locally when running the command in powershell but i do not encounter it when running it in bash. My scripts runs in docker container (linux) with installed git lfs. Since it's Unix it should use bash as default command line so i don't think that the problem lies in the shell.
Note: I run this script as a job on gitlab
The --no-rewrite
flag isn't available in Git LFS 2.3.4. Git LFS has a fairly aggressive release process and as such there are a lot of new features added between versions, which usually come out every 3 months.
If you're using Ubuntu 18.04, you'll probably want to upgrade to 20.04, or at least use a newer version. The Git LFS Project provides additional binaries and packages you can use if you're uncomfortable upgrading your OS.
If you're using Windows for certain things, you should just upgrade your version of Git for Windows. Git LFS is shipped with Git for Windows, and the easiest way to get a newer version is to upgrade Git. Installing a newer version by hand is tricky there because it's hard to override the built-in version.