Unable to delete file from git commit

How to reset all git commits that have not been pressed and then force git to do nothing in the data directory / <? >

I am trying to rewrite all changes to a project stored on github from my c9.io project. I accidentally git added some mongodb data files. I tried adding the data / directory to .gitignore. I pulled from github to get the updated .gitignore, however, when I try and git push, these stubborn files in the data / are still set for commit. I also tried git reset, git rebase, git clean and this , where I changed dmpfile.sql to pi / data / node -login.1.

Please help, I was at this for hours, and I am very upset.

Counting objects: 15, done. Delta compression using up to 2 threads. Compressing objects: 100% (13/13), done. Writing objects: 100% (13/13), 150.22 KiB | 92 KiB/s, done. Total 13 (delta 6), reused 0 (delta 0) remote: warning: File pi/data/local.0 is 64.00 MB; this is larger than GitHub recommended maximum file size of 50 MB remote: warning: File pi/data/node-login.0 is 64.00 MB; this is larger than GitHub recommended maximum file size of 50 MB remote: error: GH001: Large files detected. remote: error: Trace: e6ade98208c08b634ed28aefea36dfbb remote: error: See http://git.io/iEPt8g for more information. remote: error: File pi/data/node-login.1 is 128.00 MB; this exceeds GitHub file size limit of 100 MB To git@github.com:bobbyg603/goddard.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'git@github.com:bobbyg603/goddard.git' 

.gitignore:

 lib-cov *.seed *.log *.csv *.dat *.out *.pid *.gz data/ pids logs results npm-debug.log node_modules .project .settings 

Thanks Bobby

+65
git github terminal
Jan 16 '14 at 17:34
source share
5 answers

Thanks to Chris, I was able to fix this by doing the following:

git filter-branch -f -index-filter 'git rm --cached --ignore-unmatch pi / data / node -login.0'

git filter-branch -f -index-filter 'git rm --cached --ignore-unmatch pi / data / node -login.1'

git filter-branch -f -index-filter 'git rm --cached --ignore-unmatch pi / data / local.0'

+112
Jan 16 '14 at 18:08
source share
 git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch FOLDERNAME" -- --all 

replace FOLDERNAME with the file or folder that you want to remove from this git repository.

+67
Jul 01 '14 at 12:23
source share

This worked for me:

 git rm --cached name_of_a_giant_file git rm --cached name_of_another_giant_file git commit --amend -CHEAD git push 

Source: Github Help: Working with large files

+16
Aug 19 '16 at 18:52
source share

I used the BFG Repo Cleanner simple and fast, works like a charm

+2
Mar 23 '16 at 13:21
source share
 git filter-branch --tree-filter 'rm -rf path/whaever' HEAD 

This is a little easier, and it is a way to simply delete and rewrite it from the story. Here is the result

 Rewrite 5ac3045254d33fc5bb2b9fb05dccbdbb986b1885 (61/62) (24 seconds passed, remaining 0 predicted) Ref 'refs/heads/features_X' was rewritten 

Now i can push

0
Apr 11 '19 at 15:40
source share



All Articles