Skip to content

Instantly share code, notes, and snippets.

@bulv1ne
Created May 17, 2013 12:58
Show Gist options
  • Save bulv1ne/5598865 to your computer and use it in GitHub Desktop.
Save bulv1ne/5598865 to your computer and use it in GitHub Desktop.
My lazy way to commit and push at a remote server
#!/bin/bash
# Get directory of project where this script is
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Go to directory
cd $DIR
# Get the remote SSH command
SSH="$( git remote -v | grep live | grep push | awk '{ print $2; }' | cut -f1 -d":" )"
# Do the command as root over ssh
ssh -t $SSH "cd $DIR; sql/sqlbackup.sh && git add . && git commit -a -m 'Puppy' && git push"
# Get the data
git pull live
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment