Github LFS x Unity - 仍然无法推送回购
Github LFS x Unity - Still can't push repo
我试图将我的 unity repo 推送到我的 github 但由于文件太大我想使用 LFS。安装了 LFS,在终端中 运行 git lfs install
添加、提交和推送,我得到以下错误:
remote: Resolving deltas: 100% (18056/18056), done.
remote: warning: File Library/PackageCache/com.unity.burst@1.6.0/.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/com.unity.burst@1.6.0/.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/com.unity.burst@1.6.0/.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/com.unity.burst@1.6.0/.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.
在我的根目录中,我有一个经典的 .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/*
和经典的 .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
我是不是缺少初始化 LFS 的东西?它似乎试图在不使用 LFS 的情况下推送 repo..
谢谢!
安装 LFS 仅影响 new 提交。您必须重写存储库才能将旧文件也移动到 LFS:
做一个新的 git clone --mirror
是最安全的,原因如下:
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 git@github.com: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.)
我试图将我的 unity repo 推送到我的 github 但由于文件太大我想使用 LFS。安装了 LFS,在终端中 运行 git lfs install
添加、提交和推送,我得到以下错误:
remote: Resolving deltas: 100% (18056/18056), done.
remote: warning: File Library/PackageCache/com.unity.burst@1.6.0/.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/com.unity.burst@1.6.0/.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/com.unity.burst@1.6.0/.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/com.unity.burst@1.6.0/.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.
在我的根目录中,我有一个经典的 .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/*
和经典的 .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
我是不是缺少初始化 LFS 的东西?它似乎试图在不使用 LFS 的情况下推送 repo.. 谢谢!
安装 LFS 仅影响 new 提交。您必须重写存储库才能将旧文件也移动到 LFS:
做一个新的 git clone --mirror
是最安全的,原因如下:
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 git@github.com: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.)