Skip to content

Instantly share code, notes, and snippets.

@TechplexEngineer
Created July 12, 2013 02:45
Show Gist options
  • Select an option

  • Save TechplexEngineer/5981040 to your computer and use it in GitHub Desktop.

Select an option

Save TechplexEngineer/5981040 to your computer and use it in GitHub Desktop.
Host gh
HostName github.com
User git
Host pt-git
HostName blake.metheus.org
User git
Host pt
HostName blake.metheus.org
User techplex
Host rpi
HostName blake.team2648.com
User techplex
IdentityFile /home/techplex/.ssh/rpi
#!/bin/bash
#path to production files
livePath="/var/www/plextex"
#path to devel files
devPath="/var/www/dev.plextex"
#path to the headless repo
repoLoc="/home/git/plextex.git"
#$1 = directory to ensure access
assert_dir_access() {
(cd ${1:?pathname expected}) || exit
}
#$1 = the path to the root site
laravel_storage_perms() {
cd $1
chmod -R g+w storage
chgrp -R www-data storage
}
#$1 = path
#$2 = branch
git_checkout_latest() {
GIT_WORK_TREE=$1 git checkout -f $2
}
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ "master" == "$branch" ]; then
assert_dir_access $livePath
git_checkout_latest $livePath $branch
laravel_storage_perms $livePath
echo "Update pushed to develop branch"
elif [ "$branch" = "develop" ] ; then
assert_dir_access $devPath
git_checkout_latest $devPath $branch
laravel_storage_perms $devPath
echo "Update pushed to develop branch"
else
echo "Error: Unrecognized Branch: $branch"
fi
done
#!/bin/bash
#start
rm -rf plextex.git/
git init --bare plextex.git
ln -s /home/git/post-receive /home/git/plextex.git/hooks/
#stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment