Git LFS: Error: failed to push some refs to
Asked Answered
O

5

8

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?

Ozoniferous answered 7/8, 2018 at 10:2 Comment(0)
S
16

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 πŸ™ŒπŸΌ

Sceptre answered 12/9, 2019 at 20:38 Comment(3)
Worked like a charm with our Bitbucket server, thanks a lot. Strangely, there is no mention in the vendor documentation. – Gwenny
Glad it helped, @void! And thanks for bumping me over 6k rep πŸ₯³ – Sceptre
This was a life saver. It never occurred to me that bitbucket was the culprit. – Effulgence
A
3

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

Addison answered 21/8, 2018 at 14:42 Comment(0)
N
0

My problem is associated with multiple branches. Somehow I have contradictory binary files on different branches. I have tried all the methods posted by many other people. All failed. In the end, I deleted from one branch the push. Then added it back. It could a be due to any case not implemented by the lfs system. There might be other better methods.

Nicaragua answered 9/6, 2022 at 20:25 Comment(0)
K
0

I had a similar problem. I could fetch and pull but not push. And it started after weeks of no issues pushing at all. I was using the Command Prompt for manual git commands with no issues, but suddenly it would fail when it tried to push the LFS data. Git would ask for my ssh key password, the push would start and fail with a access denied "public key" message. Nothing I found on the internet helped. So I just downloaded GitHub desktop and for whatever reason git push started working again using the app. It asked for my ssh key password a dozen times for some reason, but all was well in the end.

Krupp answered 22/7, 2023 at 14:56 Comment(1)
Thanks for submitting, but I don't believe your problem is related to the question at hand. Git would ask for my ssh key password, the push would start and fail with a access denied "public key" message. -> That's a totally different error message than the one in the original post, is it not? I think you'd be better off creating a new question and answering it yourself in this case. – Wore
A
0

Just happened to me. Worked on the second try. No specific action taken. See the logs. Just replaced different infos to make it generic.

username@MACHINENAME MINGW64 repo/path (branchname)
$ git push -u origin branchname
batch response: This repository is over its data quota. Account responsible for LFS bandwidth should purchase more data packs to restore access.
Uploading LFS objects:   0% (0/1), 0 B | 0 B/s, done.
error: failed to push some refs to 'https://github.com/GitHubUsername/Repo-Name.git'

username@MACHINENAME MINGW64 repo/path (branchname)
$ git push -u origin branchname
Uploading LFS objects: 100% (1/1), 38 KB | 0 B/s, done.
Enumerating objects: 10, done.
Counting objects: 100% (10/10), done.
Delta compression using up to 8 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (9/9), 2.50 KiB | 854.00 KiB/s, done.
Total 9 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
remote:
remote: Create a pull request for 'branchname' on GitHub by visiting:
remote:      https://github.com/GitHubUsername/Repo-Name/pull/new/branchname
remote:
To https://github.com/GitHubUsername/Repo-Name.git
 * [new branch]      branchname -> branchname
branch 'branchname' set up to track 'origin/branchname'.
Approbation answered 22/8 at 19:44 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.