adamyonk
adamyonk

Reputation: 3175

Update git remote repo on push

ON A SERVER

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

Answers (2)

Matthieu
Matthieu

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

Cameron Skinner
Cameron Skinner

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

Related Questions