Rijk
Rijk

Reputation: 11301

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 svn up.

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 :)

Upvotes: 7

Views: 4486

Answers (1)

ralphtheninja
ralphtheninja

Reputation: 133008

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.

Upvotes: 6

Related Questions