Git LFS Issue even after following every step to push Git LFS files.
Objective: How to solve Git LFS failing to push even after following all steps to push Git LFS files.
Before doing anything, Let me show you what error am getting even if I install the git lfs extension.
This happened because, when you push refs to GitHub, the changes are being rejected because your push contains a file that is too large. Confusingly,
git lfs track does not apply retroactively to files that already exist in your repository and match that pattern.
In the first step, you need to migrate the file with the git lfs command which is git lfs migrate import — include=“/path/to/file”.Then Accept yes by typing y to migrate but you need to be careful if you didn't commit you will lose the untracked file.
Now we need to Push the converted repository as a new repository, we do this by using the command. By using git push — set-upstream origin master
But as you notice still we are unable to push since these files will always corrupt and make the push process fail. To solve this we need to copy this *.LightingData.asset filter=lfs diff=lfs merge=lfs -text command and paste them to the .gitattribute file.
After making some changes to our .gitattribute we need to add the changes and commit the changes. Then Final push the changes to the GitHub.
Note: Why do we ignore the light data file? To prevent LightingData.asset to become corrupted I highly recommend treating it like a binary file. When working we have had multiple occurrences where the LightingData.asset ended up corrupt when pushed through LFS due to the unityyamlmerge
The reference of the Note: is Hoodad.
See the results, see you in the next article.
Here is the result on the Github.