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.

  • Development process, deployment, GitHub
  • Need different .htaccess for staging and live site from Git repo
  • Permission denied (publickey) when deploying heroku code. fatal: The remote end hung up unexpectedly
  • Permission denied error when using Github deploy keys
  • Jenkins' homepage loading very slowly
  • Git philosophy: how to get “master” branch to “production” branch?
  • 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

    I can’t help but feeling the Git developers ‘didn’t really thought about this’.. I hope I’m missing something 🙂

  • How to set a version dependent Git global config flag
  • git log pretty format
  • Can I have one project in two SVN repositories?
  • Git tagging with stash and sourcetree
  • Why does using “sudo” use root user as the context for some operations, and not for others?
  • Synchronizing Git repos across machines without push
  • 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.

    Git Baby is a git and github fan, let's start git clone.