0

At first I created a new branch to push the code and then it gave me error that src.zip large file so I deleted that large file by going through the folders and I again pushed the same code and it is still showing that large file error which I have already deleted. also I created a new branch to push but it is showing the same error of the large file on this branch too. NewBie here please help.

Uploading LFS objects: 100% (304/304), 307 MB | 1.1 MB/s, done
Enumerating objects: 1210, done.
Counting objects: 100% (1210/1210), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (774/774), done.
Writing objects: 100% (788/788), 218.86 MiB | 6.96 MiB/s, done.
Total 788 (delta 257), reused 0 (delta 0)
remote: Resolving deltas: 100% (257/257), completed with 81 local objects.
remote: warning: File src/doctorPhone/RaxaFlutter/.dart_tool/flutter_build/2df7223b49177d7318e9bb97b2996866/app.dill is 54.92 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: f7149ed9934cffbf584a9a95455829192e42d3caf9ecb80f50de60b697395238
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File src.zip is 169.55 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/usename/repoName.git
 ! [remote rejected]     hipconsent -> hipconsent (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/usename/repoName.git'
  • jurez's answer correctly suggests first consulting the owner unless you are pretty sure that the particular file in question is not required. Try to know how they recommend storing that particular large file. Generally git warnings are thrown for file sizes over 50 MB and error for 100 MB or more. It appears the admin has configured a different size-limit restriction. – Asif Kamran Malick Mar 27 '21 at 12:28

2 Answers2

0

Your earlier commits might still contain the file. Please try to delete it from the remaining commits too.

You can use the tree-filter with filter-branch which will delete the file entirely from history,

git filter-branch --tree-filter 'rm -rf app.dill' HEAD

EDIT 1: START

For rewriting history, Git now recommends using an alternative tool called git filter-repo instead of the filter-branch.

From the Git documentation :

Please use an alternative history filtering tool such as git filter-repo.

The above filter-branch command could be rewritten for the suggested filter-repo as follows:

git filter-repo --invert-paths --path app.dill

EDIT 1: END

Asif Kamran Malick
  • 2,409
  • 3
  • 25
  • 47
  • I have done this and it says `cannot rewrite branches: You have unstaged changes`. Does that mean the file is removed? – nihal srivastava Mar 27 '21 at 13:19
  • In git's terminology `unstaged changes` means you have unsaved changes. `git status` should help you find out which files are not yet staged.Try staging your changes with `git add` command. – Asif Kamran Malick Mar 27 '21 at 14:21
  • Says git filter-branch --tree-filter 'rm -rf app.dill' HEAD after running this command :error: unable to create file src/chw/demoVersion2/Icon?: Invalid argument Could not checkout the index – nihal srivastava Apr 01 '21 at 11:19
  • not sure about this `unable to create file` issue. Looks like someone did face [similar issue earlier](https://stackoverflow.com/questions/56345898/unable-to-create-file-when-rewriting-history). Unable to recall to have faced that myself. Couple of issues related to `filter-branch` that I remember to have faced in past is that of not providing full path to the file to be deleted and not running the command from the root dir. If that link still doesn't help you try updating your post with your findings. – Asif Kamran Malick Apr 01 '21 at 15:22
0

Whoever set up your repository decided that they do not want files larger than 50 MB to be stored in it.

This is usually for a good reason. Storing big files is (except in certain very rare cases) an antipattern for using git.

Talk to the owner of the repository and discuss how and where your files should be stored.

If you don't want to add this big file, remove it from disk, tell git about the change (git add filename) and amend your commit (git commit --amend). At that point, you should be able to push your commit to the repository.

jurez
  • 4,436
  • 2
  • 12
  • 20