Skip to content

Instantly share code, notes, and snippets.

@slvdrvlc
Forked from explorador/Secure .git directory!
Created April 8, 2021 03:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slvdrvlc/96e13e8de2c8c16edb810e58e67e0061 to your computer and use it in GitHub Desktop.
Save slvdrvlc/96e13e8de2c8c16edb810e58e67e0061 to your computer and use it in GitHub Desktop.
# -------------------------------------------------
# Protect your .git directory!
# (You don't want anyone to download a copy of your website)
# -------------------------------------------------
# Add to .htaccess
# For Apache 2.4
<DirectoryMatch "^/.*/\.git/">
Require all denied
</DirectoryMatch>
# For Apache 2.2
<DirectoryMatch "^/.*/\.git/">
Order deny,allow
Deny from all
</DirectoryMatch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment