views:

224

answers:

3

I am running a PHP - MySQL website, and have set up a remote repository on my own server using Git.

I now want a way to be able to have a production and a test server, and some how be able to push my changes from dev to production easily. and seamlessly.

+2  A: 

Please don't use git for deployment.

Setup, like, usual build proccess. Build a zip, do minification and lint and friends along the way...and have configuration in separate file.

And use BuildBot or Hudson or whatever to automate it.

Future generations will thank You.

Almad
Why do you advise so strongly against git? How do I best use BuildBot or Hudson then?
Mike Silvis
Not against git, but against using any VCS as deployment tools. For Hudson/BuildBot, see their documentations.
Almad
+1  A: 

You can use a deployment system with git by setting up a post-update hook on the production server's repository.

If you don't need a deployment system, but only want some of the files in the repo deployed, you can use a .gitattributes file and the git-archive command in the post-update hook.

jcordasc
A: 

If Git is the route you want to go, try having two separate branches of the code (test and production). Do all your work on test, make sure it functions properly, then merge it into production. Set your server to read files from the production branch and you should be in business.

I agree with @Almad, though - if you're looking for a more robust deployment solution, a VCS is not the way to go (since deployment kind of cuts against the VCS' purpose).

ABach