Skip to content

Add prohibited filename exemptions

Problem to solve

You can prohibit filenames using push rules to prevent certain types of files being added to the repo. However, the negative lookback/lookahead are not supported for security reasons, which prevents more complex rules like:

  • prohibit all jar files except if they are in the `resources1 directory

Further details

For example, no way to implement:

^(?!(?:.*\/)?src\/test\/resources(?:\/|$))(?!.*gradle-wrapper\.jar$).*\.(?:jar|exe|a|ar|cpio|shar|iso|LBR|lbr|mar|sbx|tar|bz2|F|gz|lz|lzma|lzo|rz|sfark|sz|xz|z|Z|7z|s7z|ace|afa|alz|apk|arc|arj|b1|ba|bh|cab|car|cfs|cpt|dar|dd|dgc|dmg|ear|gca|ha|hki|ice|kgb|lzh|lha|lzx|pak|partimg|paq6|paq7|paq8|pea|pim|pit|qda|rar|rk|sda|sea|sen|sfx|shk|sit|sitx|sqx|tar.gz|tgz|tar.Z|tar.bz2|tbz2|tar.lzma|tlz|uc|uc0|uc2|ucn|ur2|ue2|uca|uha|war|wim|xar|xp3|yz1|zip|zipx|zoo|zpaq|zz|dll)$

Proposal

Add a new push rule to bypass the Prohibited filenames push rule:

Prohibited filename exemptions Prohibited filenames that match this regular expression will be exempted and may be pushed. If this field is empty no filenames will be exempted.

Links / references

Edited by James Ramsay (ex-GitLab)