Skip to content

Instantly share code, notes, and snippets.

@kevinarrieta
kevinarrieta / post-receive.txt
Created January 21, 2021 00:08
Git post-receive hook sample for Laravel deployment
#!/bin/sh
# The production directory
TARGET="/var/www/{domain}/html/{project}/" # trailing slash matters
# A temporary directory for deployment
TEMP="/var/www/{domain}/tmp/{project}/" # trailing slash matters
# The Git repo
REPO="/var/www/{domain}/git/{project}.git"
# Deploy the content to the temporary directory
mkdir -p $TEMP
git --work-tree=$TEMP --git-dir=$REPO checkout -f