0

While trying to commit changes in git, I get the following error

remote: error: File folder/Unconfirmed 866711.crdownload is 486.30 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected
![remote rejected] master -> master (pre-receive hook declined)

So, I tried removing the cached file using the command given here

git rm --cached "Unconfirmed 866711.crdownload"

also,

git rm --cached "Unconfirmed\ 866711.crdownload"

But, it doesn't work

fatal: pathspec 'Unconfirmed\ 866711.crdownload' did not match any files

Any suggestions on how to resolve this problem? EDIT: Following the suggestions below, I tried

git filter-branch --force --index-filter "git rm --cached --ignore-unmatch folder/Unconfirmed 866711.crdownload" --prune-empty --tag-name-filter cat -- --all

I get the following,

Rewrite 493310fe1e5fd4f06c9ee30b5b5157baae05358b (265/266) (181 seconds passed, remaining 0 predicted)
WARNING: Ref 'refs/heads/master' is unchanged
Ref 'refs/remotes/origin/master' was rewritten
WARNING: Ref 'refs/stash' is unchanged

Following git filter, I deleted the large file from the folder and did

git push origin --force --all

This results in the same error

remote: error: File folder/Unconfirmed 866711.crdownload is 486.30 MB; this exceeds GitHub's file size limit of 100.00 MB
Natasha
  • 1,111
  • 5
  • 28
  • 66
  • Does this answer your question? [How to remove/delete a large file from commit history in Git repository?](https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-git-repository) – phd Dec 16 '19 at 12:13
  • https://stackoverflow.com/search?q=%5Bgit%5D+remove+large+file+history – phd Dec 16 '19 at 12:13
  • @phd I tried `git filter-branch --tree-filter 'rm -f folder/Unconfirmed 866711.crdownload' HEAD` suggested in one of the posts in the links that you share. Unfortunately, I get `fatal: ambiguous argument 'folder/Unconfirmed': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]'` . Probably because of the space in the file name the path to file appears to be broken. Any suggestions on how to track paths of file names with spaces? – Natasha Dec 17 '19 at 03:49
  • https://stackoverflow.com/questions/21394563/removing-sensitive-data-from-git-fatal-ambiguous-argument-rm helped. Thanks – Natasha Dec 17 '19 at 03:52

2 Answers2

1

You can use filter-branch with a filename in the space using an escape character. So if your large file is called huge file.zip, your commands will be:

git filter-branch --tree-filter 'rm -rf huge\ file.zip' HEAD
git push  
Lewy Blue
  • 452
  • 3
  • 16
0

I have tried to follow the question and seem like it is because of a large file.

I have followed an article on medium, hopefully, it can be of help.

Please find https://medium.com/@marcosantonocito/fixing-the-gh001-large-files-detected-you-may-want-to-try-git-large-file-storage-43336b983272 as the link for same.

As per my understanding, this is happening since file is tracked now and command which can be of help is: git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch fixtures/11_user_answer.json'

Hemant Kumar
  • 186
  • 6
  • https://stackoverflow.com/questions/21394563/removing-sensitive-data-from-git-fatal-ambiguous-argument-rm helped – Natasha Dec 17 '19 at 03:53
  • Unfortunately, I get the same error. Please see the updates in my original post. Note: I'm using git on Windows – Natasha Dec 17 '19 at 05:48