Without really thinking about it, I've been committing and then pushing to my Github repository the images I am using in development.
After discovering that this was causing issues that prevented me from pushing my project to my branch, I searched for a solution to remove those images from my repository then add those images to my gitignore file.
I found several solutions: StackOverflow, this blog, git and a few others. They all seemed to be pushing me the same way:
git rm --cached -r /public/uploads/image/file/**
I've run a few variations of this code, like dropping **
, file/**
, --cached
, and image/file/**
, but it doesn't change the fact that I can still see the files on my GitHub branch.
Also I've added this to my gitignore file: /public/uploads/image/file/**
But when I push to the repository branch I get this info telling me why I can't push to Github:
I started from git add .
for context.
ruby 2.3.3-p222
╳ project_name categories ◆ git add .
ruby 2.3.3-p222
╳ project_name categories ◆ git commit -m "trying to get a commit in after purging development environment image data"
[categories 8c13b0a] trying to get a commit in after purging development environment image data
1 file changed, 1 insertion(+), 3 deletions(-)
ruby 2.3.3-p222
╳ project_name categories git push origin categories
Counting objects: 3840, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3664/3664), done.
Writing objects: 100% (3672/3672), 163.83 MiB | 3.98 MiB/s, done.
Total 3672 (delta 1242), reused 0 (delta 0)
remote: Resolving deltas: 100% (1242/1242), completed with 57 local objects.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 85ba931580b369a222fcf5903416f84e
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File public/uploads/image/file/30/show_55MiEk4_-_Imgur.gif is 119.49 MB; this exceeds GitHub's file size limit of 100.00 MB
To git@github.com:Lenocam/project_name.git
! [remote rejected] categories -> categories (pre-receive hook declined)
error: failed to push some refs to 'git@github.com:Lenocam/project_name.git'
So, now I'm confused because doesn't adding /public/uploads/image/file/**
to my gitignore file tell git to ignore the folder and the files inside of it? Why does the file continue to be pushed to my repository?
It seems to me I've asked git/Github to get rid of those old files(through the terminal command) and completely forget they ever existed so they will stop asking me about them(through gitignore).
I assume I've done something out of order or otherwise incorrectly. Any assistance you're able to give me will be appreciated.