Created
October 20, 2015 02:31
-
-
Save J3RN/39fba3d597ea33a31dd4 to your computer and use it in GitHub Desktop.
A post-update Git hook that I use to deploy my portfolio site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
GIT_REPO=$HOME/portfolio.git | |
TMP_GIT_CLONE=$HOME/tmp_portfolio | |
PUBLIC_WWW=$HOME/www | |
touch $HOME/deploy | |
git clone $GIT_REPO $TMP_GIT_CLONE | |
cp -rv $TMP_GIT_CLONE/* $PUBLIC_WWW | |
rm -rf $TMP_GIT_CLONE | |
exit |
Oh, projectname.git is a directory name and not a .git file. Okay, this makes a little more sense.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So if the current repo is
A
, it clonesA
into~/tmp_portfolio
, then copies~/tmp_portfolio/*
into~/www
?Why not just
cp -rv ../../* $PUBLIC_WWW
?../..
in the context ofpost-update
should be the repo, and that way you wouldn't need to keep a copy ofportfolio.git
in your$HOME
.Or am I missing something strange about the hosting provider?