is it bad to store apache conf files on github?

What is better is to store an httpd.conf.tpl template file with placeholder values in it.

That allows you to generate the right httpd.conf file locally, and to do so automatically on git clone/git checkout.

The generation script will:

  • search the right values for any sensitive data from an external secure referential (like a vault)
  • replace the placeholder value in httpd.conf.tpl to generate the right httpd.conf (that can be ignored by Git)

For that, do register (in a .gitattributes declaration) a content filter driver.

smudge (image from “Customizing Git – Git Attributes“, from “Pro Git book“)

The smudge script will generate (automatically, on git checkout or git switch) the actual httpd.conf file as mentioned above.
Again, the generated actual httpd.conf file remains ignored (by the .gitignore).

See a complete example at “git smudge/clean filter between branches“.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top