This question has already been answered:

On the production server, in the root folder of the site public_html, in addition to the site’s files and folders, there is actually a .git pack. Updating site files comes from the Git repository. How can you move the .git folder above the public_html directory without breaking anything (so that the git pull command updates the contents of the public_html folder as before)

Reported as a duplicate by Nick Volynkin , torokhkun , ermak0ff , Community Spirit Nov 20 '15 at 8:12 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • Alternatively, you can configure your HTTP server so that it does not give the contents of the .git folder. - dzhioev
  • .htaccess application with "deny from all" inside? - Enshtein
  • Depends on your server. But I would not advise putting something in .git. - dzhioev
  • The article habrahabr.ru/post/70330 has a solution. - dzhioev
  • Thanks for the link to an interesting article! Moving the repository (.git folders) outside the root folder of the site would certainly be the ideal solution, only I don’t really know how to do it ... - Enshtein

1 answer 1

The flag - git-dir = path_to_.git will help you, or the environment variable GIT_DIR, but in general it is a duplicate