So I tried to push a directory to github from windows. I did the git init
and git add .
prior to making the .gitignore file. So when I pushed there was a folder that was loading which I did not want in there. I ended up getting the "remote: error: File subdir/to/ignore/... is 240 MB; this exceeds GitHub's file size...
So I now in my .gitignore I have:
subdir/
old/
__pycache__/
*.pdf
Data/
I ended up trying to redo the git procedures with:
git remote rm origin
git rm -r --cached .
git add .
git commit -m "First commit of files"
git branch -M main
git remote add origin https://...
git push -u origin main
So then the git process tried to push the same subdir/to/ignore/... So then I moved this folder to a totally different location so that it would not be in the directory. Then I did the procedures above, but the same thing happened. "remote: error: File subdir/to/ignore/... is 240 MB; this exceeds GitHub's file size...
What do I need to do?
CodePudding user response:
As others have pointed out in the comments, stuff sticks around, so this situation is actually hard to fix if you want to keep the existing repo, although it has been addressed in other questions on SO.
But... since you just created this repo, I presume you have no history you want to preserve. So start again from scratch: delete that repo altogether on GitHub. Delete the .git
folder locally (which will make the directory no longer be a repo), and start all over again with your .gitignore
in place this time.
After you've done your commit and before you push, you should examine what you've committed and are about to push:
git show --stat
will list all of the files, for example.du -h .git
will tell you the local size of your repo, which will not be identical to the remote size, but will be a warning flag if it's really big.