Last active
May 24, 2022 09:32
-
-
Save cmdallas/17ce037e3465c034b6a2fb12734a906c to your computer and use it in GitHub Desktop.
Sync to remote dev server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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