我的 git 存储库中有一个 75.28MB 的文件,因此 GitHub 抱怨,我添加了 LFS 支持。该分支现在已提交给主分支。我的其他分支机构现在正在开展 LFS 工作。
下面我在
dev-status
分支上,但它给了我错误:
% git push origin
Enumerating objects: 593, done.
Counting objects: 100% (425/425), done.
Delta compression using up to 10 threads
Compressing objects: 100% (352/352), done.
Writing objects: 100% (371/371), 27.88 MiB | 8.09 MiB/s, done.
Total 371 (delta 255), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (255/255), completed with 33 local objects.
remote: warning: See https://gh.io/lfs for more information.
remote: warning: File 0ecea93eba3e57e36581c06aca7677408e78f6b6 is 75.28 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: warning: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote:
remote: Create a pull request for 'dev-status' on GitHub by visiting:
remote: https://github.com/Plant-Tracer/webapp/pull/new/dev-status
remote:
To github.com:Plant-Tracer/webapp.git
* [new branch] dev-status -> dev-status
%
但我显然启用了 lfs:
% cat .gitattributes
etc/ffmpeg-6.1-amd64-static filter=lfs diff=lfs merge=lfs -text
%
想法?
您的整个历史记录必须上传到 Github。通过
git rm
删除大文件并用 LFS 替换它不会将其从历史记录中删除。
您必须将所有历史记录的大文件替换为其 lfs 版本。
git lfs migrate
将为您做到这一点。请参阅 Git LFS 教程中的[将现有存储库数据迁移到 LFS](将现有存储库数据迁移到 LFS)。
注意:不要使用
git push --force
,而是尝试使用 git push --force-with-lease
以避免覆盖其他人的更改。