Magento version control systems such as Git and Subversion store their metadata in hidden folders. Someone access my directory and mail me. I think I am not protecting my GIT. can anyone tell me how can I do such a setting?
In .htaccess on your server config file.
RewriteEngine on RewriteRule "^(.*/)?\.git/" - [F,L]
RedirectMatch 404 /\.git
Place this both method in
It hides any file or directory whose name begins with
.git directory or
.gitignore file by returning a 404.
Ya. Shared hosting doesn't provide Apache2 configuration. So we can create .htaccess file on root. Let me try. Nov 23, 2017 at 5:03
Right. Let me know if you have any issue. Accept answer tells this is working solution for other.– AditNov 23, 2017 at 5:07
1It's working. Unprotected version control is safe now. Nov 23, 2017 at 5:22
Your version control should not be in your live server at all. I know this happens a lot but is a bad practice.
If you are going to change something, i think you should start changing that.
In the production environment you should have only the application itself and any monitoring tool, but not version control. VCS should have an origin and working copies, and your prod environment is not the origin and it is not a working environment. Workspace and production are the most distant application stages, and like this you are mixing them together. Also, ssh to the server and do manual commands, and hot swap the code manually, is suicidal.
Look for any simple build/deployment system, and you will see that soon you will not need that anymore.
You can make it in a very simple way. start with jenkins. install Jenkins, preferably in a different server. set jenkins to pull the code in the job workspace, build your app, remove .git folder and
rsync to your server