0

I have two different servers. One is for repository and another one for web application. I'm trying to setup post-receive hook. When I push code into repository server then I want project codes to be in application server.

Server

$ mkdir /home/yo/repo.git $ cd /home/yo/repo.git $ git init --bare $ cd /hooks $ touch post-receive.sh $ chmod +x post-receive.sh 

post-receive.sh

#!/bin/bash while read oldrev newrev ref do git --work-tree=appuser@appserver:/var/www/multiverse --git-dir=/home/yo/repo.git checkout -f done 

Local

$ cd /home/Sites/multiverse $ git init $ git remote add origin repouser@reposerver:/home/yo/repot.git $ git add . $ git commit -am "initial commit" $ git push origin master 

How can I achieve this using post-receive?

1 Answer 1

2

The post-receive script must be installed inside the hooks directory of the bare git (/home/yo/repo.git/hooks) and must be named post-receive without any extension.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.