I made a mistake with git and now i cant upload to github

hi everyone! so ive been following an html/css course. i just finished creating my first website. the course im following linked all of their code, step by step, incase students needed it. i grabbed it, put it in the same folder as my project, and proceeded happily. besides one very long commit (as i commit the addition of ALL of the step by step source code from the instructor), everything went smoothly.

now, in the course, we are trying to take all of our git commits and create a repository on github. after weaving my way through error after error to try to get everything to work, im finally hitting a final roadblock: “remote: error: File Moshified/Moshify/psd/standard.psd is 366.38 MB; this exceeds GitHub’s file size limit of 100.00 MB” “Moshify” is the original source code that the instructor provided. this folder is present in most of my commits, so i can’t create the repository. is there anyway to manually go back and remove this folder from my commits so i can upload the project to github?

366.38 MB?!? I’m not surprised!

If you add the folder name to the .gitignore file, it won’t get uploaded to github, it will just stay in your local repo.

Hi kevin! thanks for the help. Im gonna write out my thought process until I either solve it or get stuck. sorry if this is wordy!
so my issue is that i have LARGE files (which i shouldn’t have committed) committed/tracked already in my git repository.
so i need to add these files to the gitignore to prevent them from being included in any future commits, but i also need to untrack them from all previous commits otherwise pushing to github will push these large files and prevent the repository from being created/added to on github.
I’ve added the filenames to my .gitignore file which is in the root of my project.
now i am trying to untrack the files via:
$ git rm --cached FILENAME
maybe my issue is the naming convention here. i imagine the space is read as a - or a _, but im getting this:
untrack_attempt
which confuses me because its inside the root folder.
ive since renamed some of the files and gitignore seems to be working, but my issue is i still have these large files in my history that I need to get rid of from all commits.
This video seems to outline what I need to do:

along with that video, i followed through this :
https://link-intersystems.com/blog/2014/07/17/remove-directories-and-files-permanently-from-git/
and Ive cleaned up my repository and now it’s small enough to push to github c: woot. thanks for the pointer, kevin!

2 Likes

Glad you figured out, when I find I committed stuff I didn’t want to I usually just go the “nuclear option” and delete the repo if that is even an option.

Just wanted to give you some props on doing it the finesse way ;D

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.