Skip to content

Instantly share code, notes, and snippets.

@zanematthew
Created January 22, 2013 19:03
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save zanematthew/4597331 to your computer and use it in GitHub Desktop.
Save zanematthew/4597331 to your computer and use it in GitHub Desktop.
This is a git post-receive hook that "deploys" code to your working tree using native git commands, edit as needed.
post-receive#!/bin/sh
###
# This file will deploy code from the repository into the
# specified web-root.
#
# File name: post-receive
#
# Instructions:
# 1. Uncomment and edit the lines below as needed
# 2. Save the file in the folder hooks/
# 3. Make the file executable by typing the following at the terminal:
# chmod +x hooks/post-receive
#
### Section 1: Git Work Tree
#
# Change the path to match your deployment root.
#
# GIT_WORK_TREE=/path/to/your/web-root git checkout -f
### Section 2: Create Zip File
#
# GIT_WORK_TREE=~/git-play-web-root-two git checkout -f
# git archive master --prefix='project/' --format=zip > `git describe master`.zip
# scp -r myzip.zip me@myhost.com:/full/path/
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment