Production and Test Server using Git
I am running a PHP - MySQL website, and have set up开发者_如何学JAVA 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.
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.
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.
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).
精彩评论