diff --git a/README.md b/README.md index 6b0ba19..a5fa158 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,11 @@ use cron for this, or write a system service definition for your system supervis systemd, OpenRC or runit). ## Tor -The leader is fetched over Tor through torify. Make sure Tor is running, or edit the script, -changing `torify git fetch` into `git fetch`. +Unless the option `--notor` is used, the leader is fetched over Tor through torify. Make sure Tor +is running, or pass `--notor` to the script, like so: +```bash +./git-mirror.sh ~/git-mirror-my-repo github gitea gitlab +``` ## Motivation GitHub has always been hypocritical, promoting open source while keeping its own stack closed. When diff --git a/git-mirror.sh b/git-mirror.sh index cd1160c..234f027 100755 --- a/git-mirror.sh +++ b/git-mirror.sh @@ -18,10 +18,16 @@ set -euo pipefail IFS=$'\n' if [[ $# -lt 3 ]]; then - echo "Usage: $0 " + echo "Usage: $0 [--notor] " exit 1 fi +tor=true +if [[ "$1" == "--notor" ]]; then + tor=false + shift 1 +fi + cd "$1" leader="$2" @@ -33,7 +39,11 @@ echo "Leader remote: $leader" echo "Follower remotes: ${followers[*]}" | tr '\n' ' ' echo; echo -torify git fetch --prune --multiple "$leader" +if [[ $tor == true ]]; then + torify git fetch --prune --multiple "$leader" +else + git fetch --prune --multiple "$leader" +fi git fetch --prune --multiple "${followers[@]}" echo