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.