Question

I am trying to push a project to github. I have a file that is larger than github size limit (500 MB), so I ignored it in .gitignore file.

The problem is that git is trying to upload this file to the repository and the upload fails.

I tried to add the file, and git indeed warns me that this file is ignored in .gitignore, but still it tries to upload it any time I am trying to push.

Any Idea ?

Was it helpful?

Solution

It doesn't matter if your file is gitignored or not: if it has been added in a commit, git will try to push it. Even if you removed this file afterwards.

A solution would be to remove the commits which contains this file. You could for example:

  • If it's not already done, add a commit which remove this file from git
  • use interactive rebase to squash this commit with the one where the file has been added

It will likely change your history, so you'd better make sure you know what you're doing. However, since you're saying you couldn't push, it should be rather safe.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top