I've configured github repository in codeship already under Repository and add branch under Deployment. And
BRANCH_NAME="${CI_BRANCH}"
ROOT_FOLDER="/home/ubuntu/code"
EC2_SERVER="blah@blah.compute.amazonaws.com"
fetch_branch="cd $ROOT_FOLDER && git fetch origin" && echo $fetch_branch
ssh $EC2_SERVER $fetch_branch
pull_branch="cd $ROOT_FOLDER && git checkout $BRANCH_NAME && git pull
origin $BRANCH_NAME" && echo $pull_branch
ssh $EC2_SERVER $pull_branch
ssh $EC2_SERVER "rsync -rvI $ROOT_FOLDER/ /home/ubuntu/www/code/"
but I've found following error by Codeship while deploying.