2

I have a git repository where some of the configuration files are auto-generated by scripts and pushed to the main branch. I like to enable branch protection rule to protect the main branch but like to disable these rules for certain file patterns.

Whether this is possible in Github?

Naga
  • 363
  • 1
  • 4
  • 14

1 Answers1

2

While it is not possible, you could isolate those auto-generated script in their own folder.

And that folder could be a submodule (as illustrated here), referencing your own repository, but following a different branch, one which is not push-protected.

git submodule add -b scripts -- /url/to/your/own/repo scripts
git commit -m "Add script branch as submodule folder"

From the main branch, a git submodule update --remote would pull the latest of the scripts branch into the scripts subfolder.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250