Skip to content

Instantly share code, notes, and snippets.

@ammist
Created November 29, 2017 18:55
Show Gist options
  • Save ammist/f7e1c2ca5f1ed8371f14596cafe91ce6 to your computer and use it in GitHub Desktop.
Save ammist/f7e1c2ca5f1ed8371f14596cafe91ce6 to your computer and use it in GitHub Desktop.
Deploy with Rsync
#!/bin/sh
#whatever your SSH key is that you need to get the data from bitbucket and/or push to your environment.
ssh-add ~/.ssh/id_rsa
rm -rf projectname
git clone git@bitbucket.org:teamname/projectnamee.git projectname
cd projectname
#switch to whatever branch you have your code in
git checkout production
#clean up files you dont want on your webserver.
rm -rf .git
cd ..
# To Upload/Import
rsync -rlvz --size-only --ipv4 --progress -e 'ssh -p 2222' projectname --temp-dir=~/tmp/ servername.domain.tld:path/to/projectname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment