6

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?

2 Answers 2

7

In .htaccess on your server config file.

(1)

RewriteEngine on
RewriteRule "^(.*/)?\.git/" - [F,L]

And (2)

RedirectMatch 404 /\.git

Place this both method in .htaccess file.

It hides any file or directory whose name begins with .git Like .git directory or .gitignore file by returning a 404.

3
  • 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.
    – Adit
    Nov 23, 2017 at 5:07
  • 1
    It's working. Unprotected version control is safe now. Nov 23, 2017 at 5:22
0

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 scp or rsync to your server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.