Simple bash tool to fetch files/directories from remote servers as tar.gz archives. Works on macOS and Linux.
curl -fsSL https://raw.githubusercontent.com/zhylon/remote-fetch/main/install.sh | bashUpdate later with the same command, or:
remote-fetch --updateremote-fetch config add prod
remote-fetch config edit~/.config/remote-fetch/servers.conf:
[prod]
host=deploy@prod.example.com
key=~/.ssh/id_ed25519
port=22
[staging]
host=user@staging.example.com
key=~/.ssh/staging_keyList servers: remote-fetch config list
Default workflow — pack on remote, download, extract locally, clean up both sides:
remote-fetch prod /var/www/app/storage/logsInto a specific output directory:
remote-fetch prod /var/www/app/storage -o ~/backupsKeep things around (any combination):
remote-fetch prod /var/www/app/storage --keep-remote --keep-local --no-extract| Flag | Effect |
|---|---|
--keep-remote |
don't delete the tar.gz on the remote server |
--keep-local |
don't delete the tar.gz after extracting |
--no-extract |
don't extract locally (implies keep-local) |
-o <dir> |
output directory (default: current dir) |
Direct copy — single file or dir, no tar wrapping (uses rsync):
remote-fetch copy prod /var/www/app/.env
remote-fetch copy prod /var/www/app/.env ~/secretsremote-fetch <server> <remote-path> [flags] # default: tar workflow
remote-fetch copy <server> <path> [out-dir] # direct rsync
remote-fetch config list|edit|add <n>|path
remote-fetch --update
remote-fetch --version
ssh, rsync, tar, curl — all preinstalled on macOS and standard Ubuntu.
Default fetch runs (in order):
ssh remote "tar czf /tmp/xxx.tar.gz <path>"rsyncpulls the archive with--partial(resumable)tar xzflocallyrmboth archives
Each step can be disabled via flags.