Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

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.

Edit: I currently use 'svn export' to a timestamped release folder that I symlink the public directory into with my deploy script.

like image 834
gokujou Avatar asked Mar 04 '11 17:03

gokujou


People also ask

Are Git repositories secure?

At its core, Git is not built for security but for collaboration. As such, it is not secure but can be made secure through the use of tools and best practices. Self-hosting a Git server is a security nightmare.

What should I not put in Git?

You shouldn't store credentials like usernames, passwords, API keys and API secrets. If someone else steals your credentials, they can do nasty things with it.

Why do we use Git repository?

One of the biggest advantages of Git is its branching capabilities. Unlike centralized version control systems, Git branches are cheap and easy to merge. This facilitates the feature branch workflow popular with many Git users. Feature branches provide an isolated environment for every change to your codebase.


1 Answers

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

like image 115
Arrowmaster Avatar answered Dec 10 '22 11:12

Arrowmaster