create a bare repo on a remote server
mkdir some-dir
cd some-dir
git init --barecreate a sanity-check hook:
vim hooks/post-receive
####
#!/bin/bash
echo Running $BASH_SOURCE
set | egrep GIT
echo PWD is $PWDchmod +x hooks/post-receiveOn client machine (dev machine) add the remote:
git remote add staging username@ip-address-of-server:some-dirwhere :some-dir is the absolute path (or relative, if you’re going to connect as the user) to the directory where you just created the bare repo.
# push to this remote:
git push staging master
^ remote
^ local branch being pushedexample for urbit deploying:
#!/bin/bash
echo Running $BASH_SOURCE
set | egrep GIT
echo PWD is $PWD
# Example of this output from a client machine:
# remote: Resolving deltas: 100% (1097/1097), done.
# remote: Running hooks/post-receive
# remote: GIT_DIR=.
# remote: GIT_EXEC_PATH=/usr/lib/git-core
# remote: GIT_PUSH_OPTION_COUNT=0
# remote: PWD is /home/sogrum/git-hooks/tharsis
# To 143.244.148.111:git-hooks/tharsis
# * [new branch] staging -> staging
# THARSIS_PIER=zod
THARSIS_PIER=sampel-ligbel-sogrum-savluc
PIER_LOOPBACK=12321
# Set up ruby for this script
echo "setting ruby..."
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ "staging" = "$branch" ]; then
echo "Navigating to repo..."
ORIGINAL_GIT_DIR=$GIT_DIR
unset GIT_DIR
cd /home/sogrum/project-repos/tharsis
echo "Updating staging..."
git checkout staging
git pull origin staging
GIT_DIR=$ORIGINAL_GIT_DIR
echo "Got update to staging branch, deploying..."
cd /home/sogrum/bounce-urbit
echo "current directory:"
echo $(pwd)
echo "bouncing tharsis..."
bin/bounce -c apps/tharsis/config.yml -s $THARSIS_PIER -p $PIER_LOOPBACK
fi
donesampel is 12323 ligbel is 12321