我为 git 安装了 LFS,当我尝试推送时,出现此错误:
Uploading LFS objects: 100% (18/18), 96 KB | 0 B/s, done
Counting objects: 2199, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (2137/2137), done.
Writing objects: 100% (2199/2199), 267.81 MiB | 2.29 MiB/s, done.
Total 2199 (delta 1018), reused 0 (delta 0)
remote: Resolving deltas: 100% (1018/1018), completed with 19 local objects.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: e6aa6d46525891c943a17811e644b561
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File riscv/libexec/gcc/riscv64-unknown-elf/7.2.0/cc1 is 149.98 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File riscv/libexec/gcc/riscv64-unknown-elf/7.2.0/cc1plus is 170.88 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File riscv/libexec/gcc/riscv64-unknown-elf/7.2.0/lto1 is 139.49 MB; this exceeds GitHub's file size limit of 100.00 MB
To <remote repository>
! [remote rejected] testgenerator -> testgenerator (pre-receive hook declined)
error: failed to push some refs to <remote repository>
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
Sup*_*tar 13
git config --global lfs.contenttype 0
Run Code Online (Sandbox Code Playgroud)
我有同样的问题,但非 LFS 上传很好,所以它不是服务器或基础设施阻止大文件或任何东西。
经过一番搜索,我在 GitHub 上找到了这个建议:
看起来您正在使用 Bitbucket Server 实例。您可以尝试运行该命令
git config lfs.contenttype 0,然后尝试使用 2.6.0 吗?某些版本的 Bitbucket Server 需要某个 Content-Type 标头,设置该选项应该有助于 Git LFS 提供它想要的标头。
运行该命令后,现在我的 repo 与 LFS 配合得很好!
我确实必须为每个使用 LFS 的存储库运行该命令。我尝试了变体命令git config --global lfs.contenttype 0,这似乎已经处理了我所有其余的存储库。现在我使用 LFS 没有问题了
小智 3
您尝试推送的 GitHub 服务器似乎已将文件大小限制设置为 100 MB。
解决方案:在本地存储库中安装 LFS并开始使用 LFS 跟踪这些文件。
由于您已经提交了大文件,您可以:
1.git reset --mixed <commit_before_adding_the_large_files>然后在本地存储库中安装 LFS,跟踪文件并提交更改
或
2.git commit --amend然后在本地存储库中安装 LFS,跟踪文件并提交更改
附加信息:git重置;git commit --修改