I cant upload my project to github because of a large file, which ive ignored and removed from the cache. Not sure what im missing... Will add/remove remove the large files I have in git ignore? Or if you have any advice as to how I can fix this issue I would greatly appreciate the help.
Hi Kevin,
If it's already added then it'd stay there. Your ignore list is just so unstaged files in your working copy aren't listed. So "git add ." wouldn't pick up on the ignored files, for example, and they wouldn't display if you did "git status" either. Already added files won't be removed from your index or repository as there might be files which are an exception to the rule which you explicitly want in your repository.
What you'd need to do is remove the large files explicitly even after you've added it to your ignore list. If you go to the "File Status" view (if you're on Windows I assume there's an equivalent) and make sure you "Show All" files and right-click on the file you no longer want there then you can either hit "Stop Tracking" to remove it from the index but keep the file or you can "Remove" it which will delete the file and remove it from the index.
Hope that helps
Thanks for the explanation!
Im trying your suggestion now but I cant even find the file that's preventing the upload to github. It's in working copy with the "Show all" button selected. Any ideas? (and im on mac, by the way)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here's an example:
If it's not shown there then it's probably not in your repository, or perhaps you haven't pulled the latest changes if it was committed from elsewhere.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And it's untracked and on your ignore list it won't appear at all, FYI.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok. So if it's not anywhere in my repo how can I get github to stop rejecting the upload? I do remember removing the file from the repository folder...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is the respons from the server:
git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --set-upstream origin newMaster:newMaster
Pushing to
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
POST git-receive-pack (155042013 bytes)
remote: Error code: ef2216a4ca667e62d9eae080a5600616
remote: warning: Error GH413: Large files detected.
remote: warning: See http://git.io/iEPt8g for more information.
remote: error: File design/iphone.psd is 252.33 MB; this exceeds GitHub's file size limit of 100 MB
remote: error: File design/iphone.psd is 247.47 MB; this exceeds GitHub's file size limit of 100 MB
remote: error: File design/iphone.psd is 247.42 MB; this exceeds GitHub's file size limit of 100 MB
remote: error: File design/iphone.psd is 250.42 MB; this exceeds GitHub's file size limit of 100 MB
! [remote rejected] newMaster -> newMaster (pre-receive hook declined)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah I see, you've committed it in the past and it'll end up being pushed. OK, if you *haven't* pushed any changes since you made the commit then you could actually do an interactive rebase if you're using Git. The best way is to click the "Repository" menu and go to "Interactive Rebase" which will show you a list of your commits. You can click on the 'edit' alongside the commit with that file in. This will cause your HEAD commit to be at the point you added that file, so your working copy will have those files ready to be committed. From here you can then remove the large file and hit commit where you can then continue with the rebase which will just cause your commits like they did before.
If the commit only included that file then you could delete that commit in the interactive rebase process entirely which is another option.
Perhaps make sure you back your repository up first as an interactive rebase can be a destructive process if you do things incorrectly.
HTH
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found the commit and there were a few other changes. I don't see "edit". Theres an edit message but it doesnt seem as though I can change the committed files. Here are the choices.
(sorry for the late response, I was traveling and just got home. )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
See my newly added answer as a response to this. Comments aren't allowed more than 2000 characters so I had to make it an answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could I just delete the entire commits containing the large file? I went back and removed it from most but then I get to a commit, remove it, try to comiit and receive a message along the lines of: "It looks like you were in the middle of a rebase that was interupted, would you like to continue, cancel...". I hit continue and it hangs up for a long time. I aborted one time and tried again, which is still "continuining".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It shouldn't do that so that strikes me as odd. I'd need more details to get to the bottom of that, though.
You could delete all the commits, but all of your data with it too. If you can ensure those file changes are backed up and then you can reintroduce them into your repository then that's also possible.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What information can you I provide you with? Thanks for the continued help, I appreciate it. This is not fun...
Also, I finally heard back from github support who suggested pruning (as shown below) but that did not work either. The second time I tried the command below it didnt even find the psd file but the push is still rejected. Would this have something to do with the cache being on a commit that's already on github?
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch Rakefile' \
--prune-empty --tag-name-filter cat -- --all
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Was that the command you issued? If so, 'git rm' should specify the PSD file in question. If not, could you show which command you issued?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bear in mind that if the file isn't in the root directory you'd need to supply the full path.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So what interactive rebase does is rewind to the specified commit (if none specified then it's from the last upstream commit). Imagine it to be like taking each commit from the most recent to the specified commit and putting them onto a stack (First In Last Out). Then you pop each 'commit' (changeset) off the stack and perform the specified action with them. That's what interactive rebase does.
Sorry, 'Edit' was the old naming, the new naming is 'Amend commit?'. You need to check the checkbox next to each entry that would contain the psd files you want to get rid of.
So what happens is say you have commits A, B, C, D, E, F where F is the most recent commit. Now say C and D have the PSD files in them, you'd right click on commit B and hit 'interactive rebase' (provided none of these commits have been pushed) where you're presented something similar to the following (although with less commits)
When you hit "OK" on the interactive rebase sheet it will go to the commit you've hit 'Amend commit' on and stop. At this point the top line of your log will have a tag "HEAD" on it. Now you can right click on the file and remove it.
Because you've added the file at one point, then edited it at another it means you'll get a merge conflict. Whether you resolve using theirs or mine doesn't matter, what matters is that you make sure it's removed again from the next point. Remember that when you hit commit after you've removed it what's actually happening is that the rebase process is continuing. So let me do a test case for you as follows.
You have a bunch of commits and you want to rebase interactively from the commit before you added the file as follows:
Now make sure you click the 'Amend commit' checkbox next to the commits which have that file (or multiple files) in them as follows:
When you hit OK it will now go through each of those commits listed in that dialog and do whatever action is necessary (if any at all). So in the above examples it will stop and the latter two commits (remember it's going in reverse order, so 8dec6bd is the first commit that it will stop at). At this point SourceTree will present you with the log view but the top commit will have a "HEAD" tag on the top-most commit. This is the commit it has stopped at for you to edit.
Now you can start making changes, so move the PSD file somewhere else and hit 'Commit'. Do note when you remove the file the log view won't show changes to your working copy. Make sure you drag the missing file to the staged area as shown below:
Hit commit and this causes the interactive rebase to continue (hence why 'Amend latest commit' is forcefully checked). [Note that if you get an error because it was the only file committed then follow the instructions from the output, namely issuing the command "git reset HEAD^" at the terminal].
Now you should get a merge conflict because you've edited a file which doesn't exist in the repository as it wasn't added. You'll get a warning saying you're in a merge conflict, but your repository should look something like this:
Right click on it and click "Remove" which will remove it from the commit. Hit 'Commit' again and make the commit. It will continue with the rebase and finish off and leave the repository in the same state just without that particular file like so:
Notice that the commit SHAs have changed because it rewound and reapplied the commits, so they are entirely new commits now which is why you should never do an interactive rebase on already pushed commits.
Hope that all makes sense and helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the explanation!
Im trying your suggestion now but I cant even find the file that's preventing the upload to github. It's in working copy with the "Show all" button selected. Any ideas? (and im on mac, by the way)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.