post-receive GIT Hook

?
R
Bash

Automated script triggered after Git repository updates. Executes tasks like deployment, notifications, or build processes following successful pushes.

1# Instructions
2mkdir ctw.git
3cd ctw.git
4git init --bare
5cd ctw.git
6mkdir hooks
7cd hooks
8touch post-receive
9
10# ------------------------------------------------------------------------------------------------------------
11#!/bin/sh
12#
13# An example hook script to prepare a packed repository for use over
14# dumb transports.
15#
16# To enable this hook, rename this file to "post-update".
17
18ls -l
19
20GIT_WORK_TREE=/var/www/ git checkout -f
21cd /var/www
22./deploy.sh
23# ------------------------------------------------------------------------------------------------------------
24
25#make executable
26chmod +x post-receive 
27
28

Created on 3/8/2018