Skip to content

Instantly share code, notes, and snippets.

@rudSarkar
Forked from explorador/Secure .git directory!
Created May 17, 2022 18:29
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 rudSarkar/33963c5dc25924e53afef212ad43e287 to your computer and use it in GitHub Desktop.
Save rudSarkar/33963c5dc25924e53afef212ad43e287 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