Reputation: 878
I have a Debian server and a git repo (Assembla). What I would like to achieve is to have a function which automatically fetches any new revision and puts it in our 'test' host.
Meaning that if I push a new change on the repo, I should see it within a minute on the server running already.
Is that possible?
My server runs Debian 6 Squeeze
UPDATE: I would also like to be able to tell where a folder should be placed (e.g. /src should go into the root folder).
Upvotes: 1
Views: 1226
Reputation: 21990
Shell script:
#!/bin/bash
dir=$1
cd $dir
git pull
cd -
Cron task:
*/1 * * * * root /usr/bin/bash path_to_script somedir
Upvotes: 2
Reputation: 147
You could always set up a crontab which does an update every few minutes. Something like this:
*/5 * * * * /bin/git pull origin master
I'm sure there are better ways though. But this will run the git command every 5 minutes.
Note: I'm not familiar with the Git CLI syntax, so make sure you write that correctly.
Upvotes: 1