Now that I have nginx setup I need to be able to hide my .git
directories. What kind of rewrite would I need to stop prying eyes? And where in the server {}
or http {}
block would it go?
Repository exclude - For local files that do not need to be shared, you just add the file pattern or directory to the file . git/info/exclude .
The . git folder is hidden to prevent accidental deletion or modification of the folder. The version history of the code base will be lost if this folder is deleted.
No, there isn't. But you can store in git a text files with the 2 or 3 commands you use to reconfigure each repository. You can make it a .
Deleting the . git folder does not delete the other files in that folder which is part of the git repository. However, the folder will no longer be under versioning control.
http { server { location ~ /\.git { deny all; } } }
This location
directive will deny access to any .git
directory in any subdirectory.
Note: This location block must be before your main location block, so that it can be evaluated first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With