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.

  • SASS files management in Git version control system in Ruby on Rails
  • Git: auto pull from repository?
  • Ansible: how to run task on other host inside one playbook?
  • How does Capistrano work by default?
  • Advice for using Git to manage website development?
  • Heroku: Deploying rails application troubles
  • 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 🙂

  • Is there any way to undo the effects of “git revert head”?
  • How to nest git repositories; fetch and merge
  • Enforcing PEP-8'ish formatting in Github commits
  • How make Eclipse/EGit recognize existing repository information after update?
  • Git: Deny deleting remote branch via push (like receive.denyDeletes), but only if branch is not fully merged
  • change the data directory gitlab to store repos elsewhere
  • 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.