Skip to content

Instantly share code, notes, and snippets.

@jsgao0
Last active November 3, 2016 07:10
Show Gist options
  • Save jsgao0/7e0b02f2db56de54c3898471b71d67f9 to your computer and use it in GitHub Desktop.
Save jsgao0/7e0b02f2db56de54c3898471b71d67f9 to your computer and use it in GitHub Desktop.
Git hooks: change directory, git pull, mvn package, scp.
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
cd /git/project/path || exit
unset GIT_DIR
git pull
mvn clean package
sshpass -p password scp from_path username@remote_url:to_path
else
echo "Not master"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment