1

This is a post-update hook (took it from here), I've set in the bare repository on a server. It deploys the entire repository to the path at GIT_WORK_TREE:

#!/bin/sh
export GIT_WORK_TREE=/path/to/you/live/files
git checkout -f

How to setup a post-update hook in Git in order to deploy only the dist/ folder of the repository?

zok
  • 6,065
  • 10
  • 43
  • 65

1 Answers1

1

Try this, base one this answer :

#!/bin/sh
cd /path/to/you/live/files
git archive --remote=<repo_url> <branch> dist | tar xvf -
Community
  • 1
  • 1
Emil Davtyan
  • 13,808
  • 5
  • 44
  • 66
  • thanks! got some more info about that [here](http://wildlyinaccurate.com/deploying-a-git-repository-to-a-remote-server). I got some headache with the Git syntax though, and then I ultimately realized that I don't need a bare repository on the server and I just solved my problem doing a `rsync` in the dist/ folder. – zok Sep 05 '14 at 21:00