尝试使用 LFS 将 Unity 文件上传到 git 失败并出现 "GH001 large files detected" 错误

trying to upload Unity Files to git using LFS fails with "GH001 large files detected" error

我正在尝试使用 LFS 将 Unity 项目上传到 GitHub。 director 的大小是 306MB,所以我需要我们 LFS。它总是在我用控制 c 退出的提交过程中冻结。当我执行推送时,它会说“检测到大文件使用 LFS”。

我在名为“clickToMove”的目录中执行以下步骤

git lfs install
git lfs track "clickToMove"
git add .gitattributes
git add file clickToMove
git commit -m "commitMessage"
git push origin master

我试过了 git lfs 轨道“clickToMove.**” 根据另一个关于同一问题的 Stack Overflow 我也试过做 git lfs 轨道“clickToMove/Assets” git lfs 轨道“clickToMove/Library” 等等,直到在 .git 属性文件

中跟踪所有子目录

我收到一条错误消息,提示检测到大文件并使用 LFS。

你应该使用例如 git lfs track "*.png" git lfs track "*.jpg" ... 跟踪二进制文件类型。现在您只跟踪名为 clickToMove 的文件。另外你应该设置一个合适的.gitignoreHere you can find an example of a proper .gitignore for unity. To apply the .gitignore to your committed changes refer to this 问题。