Skip to content

Instantly share code, notes, and snippets.

@cmdallas
Last active May 24, 2022 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmdallas/17ce037e3465c034b6a2fb12734a906c to your computer and use it in GitHub Desktop.
Save cmdallas/17ce037e3465c034b6a2fb12734a906c to your computer and use it in GitHub Desktop.
Sync to remote dev server
#!/bin/bash
# syncs the current project (as defined by git repo) to default instance
# get the path to the project root (where the .git folder is)
project_path=$(git rev-parse --show-toplevel 2> /dev/null)
devIp="89.149.218.170"
target="${TARGET:-$devIp}"
if [ $? -eq 0 ]; then
# name of the project folder
project_name=$(basename "$project_path")
# rsync to server ~/workspace/project-name
rsync -avL --progress \
--exclude=node_modules/ \
-e "ssh -A -p 2822" "$1" \
"$project_path"/* "${USER}"@"${target}":/home/dallas/workspace/"$project_name"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment