ubuntu - Automatic Deployment with Git - unable to run post-receive hooks -


i've created repository in /var/repo/myrepo.git using

git init --bare 

and post-receive hooks inside:

#!/bin/sh git --work-tree=/var/www/domain.com --git-dir=/var/repo/myrepo.git checkout -f 

then:

chmod +x post-receive 

now, push local remote works , know because can see local branch in

/var/repo/myrepo.git/refs/heads 

but problem hooks not work.

then if run terminal:

git --work-tree=/var/www/domain.com --git-dir=/var/repo/myrepo.git checkout -f 

all file repo copied /var/www/domain.com

so why hook not work command inside if executed bash?

update_1

as suggested, inside /var/repo/myrepo.git/hooks/post-receive i'm using:

git --work-tree=/var/www/domain.com --git-dir=/var/repo/myrepo.git checkout -f >/tmp/mylogfile 2>/tmp/mylogfile 

the file executable becouse can run with:

./post-receive 

this copy repo file inside warking dir expected, file "/tmp/mylogfile" empty.

you try debugging script outputting stdout , stderr file

#!/bin/sh git --work-tree=/var/www/domain.com --git-dir=/var/repo/myrepo.git checkout -f >/tmp/mylogfile 2>/tmp/mylogfile 

if /tmp/mylogfile empty after running hook, script not run @ all, or contain helpful error message.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -