Skip to content

Instantly share code, notes, and snippets.

@harderthan
Last active January 7, 2026 04:42
Show Gist options
  • Select an option

  • Save harderthan/d56aaf41bd7836fae011d74d55b46d4b to your computer and use it in GitHub Desktop.

Select an option

Save harderthan/d56aaf41bd7836fae011d74d55b46d4b to your computer and use it in GitHub Desktop.
sync to remote with rsync
#!/usr/bin/env bash
set -euo pipefail
REMOTE_HOST=""
REMOTE_DIR=""
SSH_PORT=22
rsync -azL --delete \
-e "ssh -p ${SSH_PORT}" \
--exclude ".git" \
--exclude ".venv" \
--exclude "__pycache__" \
--exclude "*.pyc" \
--exclude "build" \
--exclude ".cache" \
./ "${REMOTE_HOST}:${REMOTE_DIR}/"
echo "Synced to ${REMOTE_HOST}:${REMOTE_DIR}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment