Detectify - Exposed Git-repository

Apache 2.4

httpd.conf

<DirectoryMatch "^/.*/\.git/">
    Require all denied
</DirectoryMatch>

Apache 2.2

httpd.conf

<DirectoryMatch "^/.*/\.git/">
    Order deny,allow
    Deny from all
</DirectoryMatch>

Nginx

nginx.conf

location ~ /.git/ {
      deny all;
}