GitHub push rules within rulesets now support path exceptions, letting a rule apply everywhere in scope except specific paths you designate. This applies to two push rules: Restrict file paths (e.g., block JAR files everywhere except a wrapper directory) and Restrict file size (exempt paths already exceeding a new limit so you can adopt it without modifying existing files). The feature is available in public preview under the Allowed exceptions section when configuring a supported rule, and GitHub validates path patterns at save time.

2m read timeFrom github.blog
Post cover image

Questions this post answers

How do I block a file type in a GitHub repository except for one specific path, like a gradle wrapper jar?

Use the Restrict file paths push rule in a GitHub ruleset and add a path exception under Allowed exceptions. You can block a file type such as JAR files across the entire repository while allowing it at a specific path, for example exempting the pattern **/gradle/wrapper/*.jar. This feature is in public preview and GitHub validates the pattern syntax when you save the ruleset. Teams tightening repository push rules can follow ruleset feature updates like this on daily.dev.

Can I enforce a file size limit on a GitHub repository without breaking existing large files that are already checked in?

Yes, the Restrict file size push rule in GitHub rulesets now supports path exceptions, letting you enforce a size limit while exempting paths that already exceed it. This lets you adopt the new limit going forward without having to modify or remove the existing oversized files first. The feature is currently in public preview. Developers rolling out stricter repo policies can track changes like this on daily.dev.

1.9K Impressions