download my

Ashley Mervyn Graham

rsnapshot Over a Network


You can use Git to push changes of a website-or project-you manage. No changes (just an addition of a resource) are required to your local repository.

In essence we are setting up a remote git repository (which can be considered a good idea, in case your hard-drive takes a hit).

On The Server

Your remote repository will receive one change (or hook).

$ mkdir /srv/git/project && cd /srv/git/project
$ git init --bare

You can use any directory you wish, I just host my git repositores under /srv/git/

Then we create a hook: ne /srv/git/project/hooks/post-receive and insert the following inside that file:

GIT_WORK_TREE=/var/www/project-deployed git checkout -f

Like above, where ever you serve up web-pages from.

Then make it executable.

chmod +x /srv/git/project/hooks/post-receive

Local Changes

You do have to do one thing locally (technically not a change to the repository; lets call it an update).

When you’re in your local git repository, just add a remote

$ git remote add deployed ssh://
		$ git push deployed +master:refs/heads/master

If you utilize a custom SSH port, the first command would look like:

$ git remote add deployed ssh://

Just remember to change :PORT to the actual port number your server uses.


Whenever you want to update your website, a simple: git push deployed will update your live site.