Deploying code to production server(s) from Git
I’ve spent the past week reading up on Git and trying to figure out how to fit it into our company. There’s a lot of information out there, and among other resources I found the Pro Git book very useful. However, one thing that remains a mystery to me (it’s not in the book either), is how to ‘link’ the Git repository to our production servers.
Our current setup consists of one SVN server, that we all commit to (I found this can be equalled by setting up a bare Git repository in a shared location, and pushing to it). Our production servers (there are multiple customers running the same PHP codebase) are currently SVN working copies, that we update manually one at a time by running
What would the best way to approach this in Git? I thought about adding the production servers as remotes in my Git repository and pushing to them, but I think this could potentionally create confusion if the different servers get different push histories (this would be one occasion where you would actually need it to be centralized I guess). Or do you need to use a tool like https://github.com/mislav/git-deploy?
I can’t help but feeling the Git developers ‘didn’t really thought about this’.. I hope I’m missing something 🙂
One Solution collect form web for “Deploying code to production server(s) from Git”
You can achieve the same work flow with git. Setup a bare repo that you all push your code to and clone that repo on your production server. When something has happened and you want to update your production repo just do “git pull” instead of “svn up”.
This is a good start to just get things going. After a while you might want to automate this and you can do lots of cool things with e.g. git hooks.