I am unable to push my local repo to my remote origin, because of a 215 Mb file that was in the repo. When pushing I keep getting the error message:
> remote: error: File
> Elec/modelling-analysis/pickles/fitted_KNN_gridsearchs.pickle is
> 215.67 MB; this exceeds GitHub's file size limit of 100.00 MB To https://github.com/pat-hearps/elec-forecast-nem.git ! [remote
> rejected] master -> master (pre-receive hook declined) error: failed
> to push some refs to
> 'https://github.com/pat-hearps/elec-forecast-nem.git'
This is despite the file being listed in my local repo .gitignore file. I have searched through many Stackoverflow Q&A’s, such as these:
I have tried the following things:
Made sure that the .gitignore file contains both the exact filepath, and catch-alls for the folder my large file is in. My .gitignore file contains all of the below lines – yes I know it looks like amateur hour but I have been trying everything I can think of for hours and want to make sure I am ignoring this file:
./Elec/modelling-analysis/pickles/**
./Elec/modelling-analysis/pickles/*
./Elec/modelling-analysis/pickles/fitted_KNN_gridsearchs.pickle
Elec/modelling-analysis/pickles/**
Elec/modelling-analysis/pickles/*
Elec/modelling-analysis/pickles/fitted_KNN_gridsearchs.pickle
I have removed the offending file itself from my local repo (backed it up elsewhere) with
git rm -r Elec/modelling-analysis/pickles/fitted_KNN_gridsearchs.pickle
and then have used the following set of commands which I understand should untrack all files then re-add all except those in the .gitignore:
git rm -r --cached .
git add .
it commit -m "rmvd cache and re-added all"
then when I git push, I still get the same error as I did before -
remote: error: File Elec/modelling-analysis/pickles/fitted_KNN_gridsearchs.pickle is 215.67 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/pat-hearps/elec-forecast-nem.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/pat-hearps/elec-forecast-nem.git'
This is despite the file no longer being in the repo, it being untracked. Every other answer I’ve read on SO suggests that the solution I’ve tried should be working but it isn’t. I’ve tried many many different iterations and variations of this.
I also had a global .gitignore that was just called .gitignore, in my home directory. I thought maybe there might have been a conflict, so I renamed it to .gitignore_global and used this command to reset the renamed file as the global: git config --global core.excludesfile ~/.gitignore_global
But I should note that the only lines this global contains are:
.DS_store
*.ipynb_checkpoints
I have also tried these on the file:
git update-index --assume-unchanged
git update-index --skip-worktree
I’m sorry if this seems like a duplicate question, but I feel like I have spent a lot of time trying answers from similar questions and they don’t seem to be working…
Also the large pickle file was first added like 20 commits ago, resetting the repo back to before this was added would lose too much other work…