Reputation: 2946
When pushing commits I read this warning:
remote: warning: File cbbf81da77a68297dcb6870025c5bb661c63e226 is 63.25 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
But I don't know what is the file that this number points to.
I've tried https://github.com/iluaepidi/widget/blob/cbbf81da77a68297dcb6870025c5bb661c63e226 but with no sucess.
How can I know what file it is?
(note: I've tried find -size
and didn't work)
Upvotes: 1
Views: 56
Reputation: 15103
As mentioned in this answer you can try
git rev-list --objects --all | grep cbbf81da77a68297dcb6870025c5bb661c63e226
There is no direct mapping of filenames => object SHAs in Git, because multiple trees (and thus multiple commits) can refer to the same object in multiple places. The above command will show you all filenames that point to that object. If you get no results, you can probably assume it's either a tree or a commit, or it's unused.
Two commands to check that are to see what type it is:
git cat-file -t cbbf81da77a68297dcb6870025c5bb661c63e226
and if it specifies either tree
or commit
, then something is probably very much corrupt. Otherwise, if it specified either blob
or errors out, you can probably just garbage-collect your repository to get rid of it.
git gc --prune
If that still doesn't work, and you don't mind running the risk of corrupting your repository (make a backup!) then you can manually delete the object.
Objects are stored in a lookup hierarchy, which means in .git/objects
there are directories that correspond to the first byte of the object's SHA in hexadecimal format, and the contents of the directory being the object files named by their SHAs sans the first byte.
So in your case, you'll be removing the following:
rm .git/objects/cb/bf81da77a68297dcb6870025c5bb661c63e226
Though if you're to this point, it's highly indicative that something else is wrong.
If you determine the offending object is a file, and the file is somewhere rooted in the history, you might be in for a revert, or worse, a little bit of a nasty rebase.
You'll have to find the commit that introduced the file, and then run one of the following commands:
If the file was introduced by itself in its own commit:
git revert <COMMIT>
If the file was introduced alongside other changes, find the commit before the offending commit:
git rebase -i <PRIOR COMMIT>
Then navigate to the line with the offending commit and replace pick
with edit
, then write (save) and quit the editor. Git will then go into rebase mode and will check out that particular commit, at which point you can remove the offending file.
After you've removed it, run the following:
git add -A
git commit --amend
git rebase --continue
If Git finishes with success, you're good to go. Otherwise, you might have to edit a few commits in-between the initial introduction of the file and HEAD in order to remove the file from all commits that modify that file.
Upvotes: 1
Reputation: 8237
Have you tried git show <sha>
to have git show you the file?
You could also do a git ls-tree -r HEAD | grep <sha>
Upvotes: 2