How to protect against pushing large binary blobs in git?
===

I have a central git repository which myself and several collaborators regularly push and pull from. In the past I have committed a large binary blob by accident, which requires rebasing to fully delete and is a pain for everyone, so I'd like to protect against this happening in the future. Is it possible to setup a hook in the remote repository that will check the file size of files being pushed (whether they are being added new or an existing file is updated) and reject pushes with files above a threshold size, say 2MB?

Importantly I want existing files already greater than 2MB that are untouched to be tolerated (so a push shouldn't be rejected if a 2MB file is already in the repository, only if the push adds a 2MB file or grows an existing file to be 2MB). Also, I want the hook to execute on the remote side so I don't have to worry that clients don't have to have a hook setup.

Edit: Since a push can contain multiple commits, and even one commit with a large file gets it stuck in the repo, I want to protect against pushes that contain /any commit/ that grows to or adds a >=2MB file.