Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git LFS: Error: failed to push some refs to

Tags:

git

git-lfs

I installed LFS for git, and when I try to push I get this error:

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>

How can I fix this?

like image 242
Vlad Ciotlausi Avatar asked Dec 08 '22 14:12

Vlad Ciotlausi


2 Answers

tl;dr

git config --global lfs.contenttype 0

Elaboration

I had the same problem, but non-LFS uploads were fine so it wasn't the server nor infrastructure blocking big files or anything.

After some searching about, I found this advice on GitHub:

It looks like you're using a Bitbucket Server instance. Could you try running the command git config lfs.contenttype 0 and then try with 2.6.0? Some versions of Bitbucket Server want a certain Content-Type header, and setting that option should help Git LFS provide the header it wants.

After running that command, now my repo works great with LFS! 👍🏼

I did have to run that command for each repo that uses LFS. I tried the variant command git config --global lfs.contenttype 0 and that seems to have taken care of all the rest of my repos. Now I have no problem using LFS anymore 🙌🏼

like image 73
Ky. Avatar answered Dec 11 '22 07:12

Ky.


It seems the GitHub server you are trying to push to has set a file size limit of 100 MB.
Solution: install LFS in your local repository and start tracking these files with LFS.
Since you've already committed the large files, you either:
1. git reset --mixed <commit_before_adding_the_large_files>, then install LFS in your local repo, track the files and commit the changes
OR
2. git commit --amend, then install LFS in your local repo, track the files and commit the changes

Additional info: git reset; git commit --amend

like image 33
nicole Avatar answered Dec 11 '22 07:12

nicole