It usually happens because there has been some changes in the repository history. How many commits are you ahead from origin (you can check it in git status)?
Please, execute git log --graph --oneline --decorate -10 and forward me the result
I had the same issue and i posted an issue earlier, i already solved my issue.
There are 2 ways you can do it.
The command you really need will be git rebase, what it can do is to find exactly historic commits that you did, which was oversized and you delete that commit, and then you will be able to push again.
Delete the oversized files, and then delete .git and initiate again and push to remote repo. The bad thing for this method will be that you would lose all the history and need to start from 0.(Your files will still be there).
you will be able to see the commits history that you did. following is mine.
Let's say the commit that i highlighted was the commit was oversized and i want to delete it. Then i will do
git rebase -i head~5 #head~5 means you want to change the commits counting from the head to below 5 items
Then there will be a file show up. Then you press 'i' from your key board, change text from 'pick' to 'drop' to the commit you want to delete. Then you press 'esc',':',then input "wq" and 'enter'
Hi @nanjie.chen : Rebase might work but you need to be careful that you do not lost any modifications that you did in the commit. Actually, with a rebase you do not need to remove a whole commit but using rebase -i you can remove the files that are causing the problems.
@ivanmilara True. I used this method because i did know with the certain commit i wanted to delete, it only contained some videos which were oversized. I didn't change any other files within that commit. So i just dropped that commit and yes the video files were lost.(Anyway i wanted to delete them)
And actually the problem might not be that there is a big file in the workspace, but that there are big objects in the git repo (e.g. if you rebase and do squashing of multiple commits...)