Don’t serve .git folder on Apache2

Add this to /etc/apache2/apache2.conf:

# do not serve .git folders by default
<DirectoryMatch "^/.*/\.git/">
    Require all denied
</DirectoryMatch>

( Apache 2.4 – Ubuntu 18.04.1 LTS )