I can't seem to push large files (.zip) to github. LFS (version 1.3.1 installed via Homebrew) returns the following error:
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 63a488b53055cc71938b40da95b11be9
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File vanilla-app.zip is 129.25 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/hexxd/vanilla.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/hexxd/vanilla.git'
The order of operations I've been using is as follows:
git lfs track myfile
git add .gitattributes
git commit -m ".gitattributes"
git push
git add myfile
git commit -m "myfile"
git push
What am I doing wrong?
Hi @hexxd, thanks for opening this issue, and sorry to hear that you're having trouble! I think the problem lies in the existing state of your repository when you installed LFS:
Place the file in my local repository with git already initialized.
Due to the way that Git works, the file you want to track with LFS (myfile
) _cannot be staged_ before it is "tracked" via your .gitattributes
. To fix this, you can do a hard reset to before you added the file and run git lfs track myfile
before you git add myfile
. I noticed that that _is_ the order it seems you ran those commands, but if the file myfile
is _already_ staged, subsequent git add
s are treated as no-ops.
A few other things you could take a look at:
brew update && brew upgrade git-lfs
and you should be good to go.git lfs install
.Let me know if you have any more trouble!
This worked beautifully. I used BFG to clean the repo and then followed the same procedure above.
For what it's worth, I would definitely put something about cleaning the repo out (either with BFG or something else; I like BFG because I didn't have to start my repo from scratch) in the readme. I stumbled upon LFS when I realized I couldn't push 100M+ files to a repository I had already created, and I imagine the same is true for other users who are new to git and have the same problem.
Thanks @ttaylorr!
Happy to help!
Trying to get git-lfs working when you have already committed large files is a total mess. Just rewrite your history they said. I really have no idea how to do that. But.... this seems to do it all for you:
git lfs migrate import --include="*.csv"
I had large csv files with data. This added some small files too, but at least I can push.
@wsurles - your migrate command helped immensely. Thank you.
@hexxd ,hello, I meet the same issues when I commit my code that is 108.85MB. But Git remind me of that it exceeds GitHub's file size limit of 100.00 MB.so I must install git-lfs via homebrew
$ git push -u origin master
Enumerating objects: 10843, done. Counting objects: 100% (10843/10843), done. Delta compression using up to 4 threads Compressing objects: 100% (7251/7251), done. Writing objects: 100% (10843/10843), 301.63 MiB \| 488.00 KiB/s, done. Total 10843 (delta 3375), reused 10843 (delta 3375)
remote: Resolving deltas: 100% (3375/3375), done. remote: warning: File atms_last.zip is 50.27 MB; this is larger than GitHub's re commended maximum file size of 50.00 MB remote: warning: File vms.zip is 63.71 MB; this is larger than GitHub's recommen ded maximum file size of 50.00 MB remote: error: GH001: Large files detected. You may want to try Git Large File S torage - https://git-lfs.github.com. remote: error: Trace: 7df7ae259e9e4f377519f6a816738371 remote: error: See http://git.io/iEPt8g for more information. remote: error: File atms_last/atms/Reports/leave_approval_report_fc4bc09984867f4 f66e4912968a06090.csv is 109.66 MB; this exceeds GitHub's file size limit of 100 .00 MB
error: failed to push some refs to 'https://github.com/diginsheetal/bridgestone_ CLMS.git'
For those of you that are looking for a better solution in modern versions of Git LFS, the tool you're probably looking for is git lfs migrate import
and it can take --include
options which specify the pathspecs to migrate. Be sure to quote the pathspecs if they contains any characters special to the shell, such as "*".
https://github.com/git-lfs/git-lfs/issues/1933#issuecomment-351275765 provides a great example of how to use this functionality.
Helps a lot! Thank you!
@wsurles Your solution was really helpful. Thanks a lot !
Most helpful comment
Trying to get git-lfs working when you have already committed large files is a total mess. Just rewrite your history they said. I really have no idea how to do that. But.... this seems to do it all for you:
git lfs migrate import --include="*.csv"
I had large csv files with data. This added some small files too, but at least I can push.