1

I have a PHP Application Development Platform that I plan to host on Github.

I'm using this platform to power about 8 or so different sites/projects on 8 different servers powered by Ubuntu. I need to keep all the files in sync (but not necessarily in realtime - maybe every 15 minutes) i.e. I commit the files to Github, and then my local directories are automatically on each of the 8 servers so that they contain the latest files.

I don't need the local directories to keep a history, I just need them to be updated to reflect the latest version of the Github repo i.e. overwrite the last set of changes with the new one, and delete any local files and directories that might have been deleted from my github repo.

Do I need to install Git on each of the 8 servers? And if so, is there a command that will enable me easily do this, so that I can wrap it in a cron job or something?

Thanks.

ObiHill
  • 11,448
  • 20
  • 86
  • 135
  • I would heavily advise against automatically deploying code into production without human triggering it. – JohnD Sep 11 '11 at 23:09
  • possible duplicate of [Automatically Deploy From GitHub To Server On Push](http://stackoverflow.com/questions/7303518/automatically-deploy-from-github-to-server-on-push) – Treffynnon Sep 11 '11 at 23:09

2 Answers2

3

I think you're looking for Continuous Integration.

There are many different options to choose from, most of which can keep your servers up-to-date with the latest from Github (or any other git server for that matter)

  • Jenkins (Used by Github and many other companies)
  • CI Joe (Made by Github's Defunkt, written in ruby)

There are many others available, but searching "Continuous Integration" will likely find you an answer

adlawson
  • 6,303
  • 1
  • 35
  • 46
0

Easiest way would be to install git on the server, then do

GIT_DIR=/path/to/your/repo (git fetch && git reset --hard origin/master)

obviously replacing origin/master with your remote and branch.

richo
  • 8,717
  • 3
  • 29
  • 47