Amazon Autoscale & Github

I have installed centos 6.5 / apache and gitbhub on my remote server. Is it possible when the server starts (or every hour) that it pull the latest commit from my production branch, force overwriting everything it had locally?

I see the use of the git push command but since the auto-scale will happen behind the firewall, it's basically useless.

If this was already answered here, I am sorry.


Yes, you can add to the user data for your instance the following command. It needs to be run on the a directory where your git repository for your code is:

git reset --hard HEAD
git pull -f origin <your branch>

or if you don't want to care about which directory you are in:

git --git-dir=<your-git-repo-directory>/.git --work-tree=<your-git-repo-directory> reset --hard HEAD
git --git-dir=<your-git-repo-directory>/.git --work-tree=<your-git-repo-directory> pull -f origin <your branch>

To make it run every hour you can add it as cron job by creating a file under /etc/cron.d/ with the following content:

0 * * * * <your-user> git --git-dir=<your-git-repo-directory>/.git --work-tree=<your-git-repo-directory> reset --hard HEAD
1 * * * * <your-user> git --git-dir=<your-git-repo-directory>/.git --work-tree=<your-git-repo-directory> pull -f origin <your branch>

Need Your Help

QBFC: How do I query the customners by accountnumber?

quickbooks qbfc

Since Intuit has broken the QBFC reference today, I have to ask a question that I could normally look up. (I do not know who to complain to).