title: Can I configure GitHub to block large files
body: <p><a href="https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-large-files-on-github" rel="nofollow noreferrer">GitHub documentation on large files</a> states:</p>
  <blockquote>
  <p>If you attempt to add or update a file that is larger than 50 MB, you will receive a warning from Git.</p>
  </blockquote>
  <blockquote>
  <p>GitHub blocks pushes that exceed 100 MB.</p>
  </blockquote>
  <p>I want to configure it in a way that it blocks any pushes with files larger than some predefined threshold (e.g. 100kb).</p>
  <p>Is this possible? How?</p>
  <p>Maybe via the branch protection rules? I saw some examples that the branch protection rules can include custom status checks. The status checks, these are GitHub actions? So I could maybe add a custom GitHub CI action which checks for a valid commit (valid = any changed file is below the size limit).</p>
  <p>Maybe it's not really possible yet. I also asked <a href="https://github.com/github-community/community/discussions/18490" rel="nofollow noreferrer">in the official community forum</a>.</p>
  <p>(Note: If possible, I would prefer a pure-Git answer, independent of GitHub. With pure Git, this is possible via a server-side <code>pre-receive</code> hook. See <a href="https://stackoverflow.com/a/57977351/1256452">here</a>. However, on GitHub, I cannot have a custom pre-receive hook, so this is not an option.)</p>