Is it safe to run your site within a Git repository on your production server?
Back when I first started using SVN for version control I was told to use ‘svn export’ to always be running a clean copy of the code on the server.
With Git it seems like the best way to get my files on the server is just to have Git managing the application folders and tell it what tag I want it to be running. Is this an okay practice or is there a better way?
- How can I have git not change file permissions?
- How to add git hook to non /var/www folder
- Ubuntu automatically pull from Github repo
- Git workflow from local to bitbucket/github hub to live webserver
- Git environment setup. Advice needed
- How do I copy my entire website from testing area to webhost without breaking
I would of course block .git/ from public access, but it feels weird having an active version of the Git repo on the production server. (Guessing I may be missing a step…)
Thank you for any insight you can help me with in this area.
I currently use ‘svn export’ to a timestamped release folder that I symlink the public directory into with my deploy script.
3 Solutions collect form web for “Is it safe to run your site within a Git repository on your production server?”
Instead of cloning your repo on the webserver as a normal non-bare repo, you should use a method such as this one. http://toroid.org/ams/git-website-howto
One way would to organize your development and deploy process similar to the way in this post.
You can configure Apache so he can’t serve a git folder. Something like:
<Directorymatch "^/.*/\.git/"> Order deny,allow Deny from all </Directorymatch>