Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upPre-receive hook to block commits by size under 50MB #259
Conversation
…ze setting
|
Cool addition, @mzzmjd. Currently it will not work for newly created branches, when e.g. doing a Feel free to take a look at one of the other scripts on how to also capture new branches, for example platform-samples/pre-receive-hooks/block_file_extensions.sh Lines 11 to 36 in fd0818b |
|
@mzzmjd: GitHub.com and GitHub Enterprise Server (since version 2.20) now have an ability to restrict the commit size per repository to values smaller than 50 MB,, e.g. 1 MB: I will close this pull request because of this. Feel free to reopen if you believe there is still a reason for a pre-receive hook. |
mzzmjd commentedAug 6, 2019
Pre-receive hook to block commits smaller than repo Maximum Object Size setting.
We had a requirement from a user to block any file and any commit that was over 100000 bytes in size.
Obviously the Maximum Object Size setting would be useful for this:
However, as the minimum value that can be set is 50 MB this was not the way forward.
So knocked up this pre-receive hook. Not sure that it is the most efficient way of doing things, but it seems to work OK.