Reputation: 3175
ON A SERVER
I created a git repo in the working directory of my web-app /html.
To create a git 'host' repo, I ran
git clone --bare html html.git
.
I now have a git 'host' repo and a git 'client' repo on the remote server at /html.git (host) & /html (client).
I want to push from my local machine to the server and not have to do a git pull
ON THE SERVER.
ON MY LOCAL MACHINE
When I push from my local machine to the remote 'host' repo, I want to use the post-receive hook to run a git pull
on the remote 'client' repo.
Is this possible or is this the easiest way of doing this?
Going to be trying to use this method: http://toroid.org/ams/git-website-howto
Upvotes: 1
Views: 1137
Reputation: 16397
Instead of running git pull
in the remote 'client' repo, you can directly push from the 'host' repo into the client.
In /path/to/host/repo/.git/hooks/post-receive, just have something like :
#!/bin/bash
git push ../html master
Upvotes: 0
Reputation: 54276
It should be possible. The git hooks are just ordinary scripts that are given some useful arguments, so (assuming the git user has access to both repos) you should be able to do something like:
cd /path/to/client/repo && git pull host master
Upvotes: 3