I
I
Ivan Ivanov2017-02-01 15:32:27
git
Ivan Ivanov, 2017-02-01 15:32:27

How to make git hooks work?

I'm trying to set up git on the server like here https://habrahabr.ru/post/127213/
I made a Hub bare repository in the /bare folder, in the /home/git/web/site.ru/public_html folder (website folder) - Prime repository, poured the contents of the master branch from the Prime repository into the Hub, cloned the contents of the bare repository into the Denver www folder. Created a post-update file in the /bare/hooks folder with the following content

#!/bin/sh

echo
echo "**** Вытягиваем изменения в Prime [Hub's post-update hook]"
echo

cd /home/git/web/site.ru/public_html || exit
unset GIT_DIR
git pull hub master

exec git update-server-info

I added the test.txt file to the www folder on the computer for the test, made a commit, push, check the directory with the site - the test.txt file does not appear in it, i.e. apparently the hooks do not work. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
aol-nnov, 2017-02-01
@romalu

chmod +x /bare/hooks/post-update

V
Vitaliy Orlov, 2017-02-01
@orlov0562

make sure the hook works, add something like touch /tmp/1.txt at the very beginning, if it works, then log the execution of each command and see what goes wrong and where exactly the problem is.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question