I have a central git repository that I and several collaborators regularly click and pull. I used to make a large binary blob by accident, which requires a full recovery, and this is a pain for everyone, so I would like to protect against this in the future. Is it possible to set the hook in the remote repository, which will check the file size of the pressed files (are they added to a new one or the existing file is updated) and reject the sense with the files above the threshold size, say 2 MB?
It is important that existing files are already more than 2 MB, which were not transferable (therefore, you cannot drop push if the 2MB file is already in the repository, only if push adds a 2 MB file or extends an existing file up to 2 MB). In addition, I want the host to run on the remote side, so I donβt have to worry about the fact that clients do not need to set hooks.
Edit: since push can contain multiple commits, and even one commit with a large file is stuck in the repo, I want to protect against push that contain / any commit /, which grows or adds a file> = 2MB.
source share