I've tried to push my unity repo to my github but since the files are so large I thought to use LFS. Installed LFS, ran git lfs install
in the terminal, add, commit and push, and I get the following errors:
remote: Resolving deltas: 100% (18056/18056), done.
remote: warning: File Library/PackageCache/[email protected]/.Runtime/hostlin/lld is 57.95 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: warning: File Library/PackageCache/[email protected]/.Runtime/hostmac/dsymutil is 64.13 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: warning: File Library/PackageCache/[email protected]/.Runtime/libburst-llvm-11.dylib is 87.83 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: Trace: f9eeba7df30d8a51c6584e8ac73a6622802080d5c56fc4191126526d0b7a055c
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File Library/PackageCache/[email protected]/.Runtime/hostmac/lld is 106.20 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File Assets/Firebase/Plugins/x86_64/FirebaseCppApp-8_0_0.so is 118.99 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
In my root i've got a classic .gitignore:
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/
# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/
# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*
# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*
# Visual Studio cache directory
.vs/
# Gradle cache directory
.gradle/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
# Unity3D generated file on crash reports
sysinfo.txt
# Builds
*.apk
*.aab
*.unitypackage
# Crashlytics generated file
crashlytics-build.properties
# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*
and a classic .gitattributes
# Image formats:
*.tga filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.tif filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
# Audio formats:
*.mp3 filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.aiff filter=lfs diff=lfs merge=lfs -text
# 3D model formats:
*.fbx filter=lfs diff=lfs merge=lfs -text
*.obj filter=lfs diff=lfs merge=lfs -text
# Unity formats:
*.sbsar filter=lfs diff=lfs merge=lfs -text
*.unity filter=lfs diff=lfs merge=lfs -text
# Other binary formats
*.dll filter=lfs diff=lfs merge=lfs -text
Am I missing something to initialise LFS ? it seems it's trying to push the repo without using LFS.. Thanks!
CodePudding user response:
Installing LFS only affects new commits. You'll have to rewrite the repo to move the old files to LFS as well:
It's safest to do a fresh git clone --mirror
for a few reasons:
You can do a mirror clone, which will clone the remote into a bare repository locally so that you don't check out all your large files unnecessarily. It will also get all the remote branches and tags, and set up remote tracking branches so that you can safely perform a force push.
git clone --mirror [email protected]:ethomson/repo.git
git lfs migrate import --everything
git reflog expire --expire=now --all
git gc --prune=now --aggressive
git push --mirror --force
WARNING This will change your history. Make sure all outstanding work is synchronized and all developers on your repo sync their repo before continuing to work.
Get your users to reclone their repositories. I am generally loathe to encourage people to ever do this - a lot of people follow the delete and re-clone strategy when something goes wrong in their work and it's quite an anti-pattern. There are really no problems in Git that are so hairy that you need to get rid of the repository and start over; solving these problems without doing that will really level-up your Git knowledge.
This is the exception - we've rewritten every branch and there's no simple way to update. Instead, cloning a new copy of the repository is the right way to go. (Bonus: it's now much quicker to clone the repository since you don't have all those messy binaries.)