아무래도 git push 이후에 즉각 웹서비스를 올려야겠다.

hook을 이용하여 push 를 하도록 한다.

#mkdir /var/opt/gitlab/git-data/repositories/.../....git/custom_hooks
#cd /var/opt/gitlab/git-data/repositories/.../....git/custom_hooks
#vi post-receive

#!/bin/sh
cd /home/html/web/ || exit
unset GIT_DIR
git pull origin master
exec git-update-server-info
exit 0

#chmod +x pre-receive
#chown git.git pre-receive

이제 git에 push작업 끝나면 custom hook이 발생하여 post-receive에 작성해둔 명령어를 실행하게 된다.

 

참고)

git, dev서버 – user : git, group : 알아서

live, www서버 – user : 알아서, group : 알아서

답글 남기기

이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다.