DEV Community

Discussion on: Please remove that .git folder

Collapse
 
mrwensveen profile image
Matthijs Wensveen

My advice would be to never have the website root at the project root. Always use a www, html, public, or even src subdirectory. This way, the .git directory and files like README.md are not exposed to the internet.

If you deploy by using git pull on the server and your hosting provider only provides a webroot, this article has good advice. 👍

Collapse
 
po0q profile image
pO0q 🦄

Totally on point: no public access! I wrote this post for those who do not have that in mind. In fact, even if you are on a budget, you don't have to deploy such folder. It's just more convenient for many people, but not mandatory. There are other ways to sync you code.

The problem with cybersecurity is you don't always have the best conditions, so many people will tell you "don't put anything sensitive in git, etc," which it's true in a perfect world, but sometimes more difficult to achieve in reality.

I prefer having several layers, and if I can remove that .git folder from public folder, I'll do it :)

Collapse
 
mrwensveen profile image
Matthijs Wensveen

Absolutely! Sometimes hosting providers don't give a lot of options on how or where to deploy. Or maybe someone isn't even aware that this is problematic.

Maybe a web.config equivalent of this article would be useful as well, for those who use IIS.

Some comments have been hidden by the post's author - find out more