I've a environment to deploy with git and I don't know how do this. Our team works with several developers hosts (local repositories for each one) which should push for one server with the central repository. So we have other two servers with "bare" repositories for each one, but this two repositories are mirrors of the central repository and exists just for to update the project in the directories /var/www.
These two final servers are our web servers. The central server are our repository server, it should to update the webserver at moment who a developer push from your the developer machine for the central server.
I've already updated (pushed) from the dev machine directly to one web server with this post-receive hook.
#!/bin/sh
GIT_WORK_TREE=/var/www/project_name git checkout -f
But now, with this new scenario how I will make the central server to update the web servers? With post-receive? Or what?
Theoretically I want do something like this:
$ cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=ssh://user@webserver/var/www/project_name git checkout -f
$ chmod +x hooks/post-receive
Where GIT_WORK_TREE="ssh" is the webserver adress with ssh.