Git LFS:错误:无法将一些引用推送到

时间:2018-08-07 10:02:57

标签: git git-lfs

我为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>

我该如何解决?

2 个答案:

答案 0 :(得分:5)

tl; dr

git config --global lfs.contenttype 0

阐述

我遇到了同样的问题,但是非LFS上载很好,因此服务器或基础设施都无法阻止大文件或其他任何东西。

经过一番搜索,我发现了this advice on GitHub

  

您似乎正在使用Bitbucket Server实例。您可以尝试运行命令git config lfs.contenttype 0,然后尝试使用2.6.0吗?某些版本的Bitbucket Server需要特定的Content-Type标头,并且设置该选项应有助于Git LFS提供所需的标头。

运行该命令后,现在我的存储库可与LFS配合使用! ??

我确实必须为每个使用LFS的仓库运行该命令。我尝试了变体命令git config --global lfs.contenttype 0,这似乎已经处理了我所有的存储库。现在我再也没有问题使用LFS>

答案 1 :(得分:0)

您要推送到的GitHub服务器似乎已将文件大小限制设置为100 MB。
解决方案:install LFS in your local repositorystart tracking these files with LFS
由于您已经提交了大文件,因此您可以:
1. git reset --mixed <commit_before_adding_the_large_files>,然后在本地存储库中安装LFS,跟踪文件并提交更改

2. git commit --amend,然后在本地存储库中安装LFS,跟踪文件并提交更改

其他信息:git reset; git commit --amend

相关问题