ssh: improve error handling on connection failure
authoralex <[email protected]>
Sat, 21 Dec 2024 19:15:13 +0000 (11:15 -0800)
committeralex <[email protected]>
Sat, 21 Dec 2024 19:15:13 +0000 (11:15 -0800)
mirror-all

index c6c975be452403cebc3c1964709b1d9c98e4ce26..8ccbd8e7e9ded1784d12057e3d70a1dc21db7965 100755 (executable)
@@ -123,12 +123,12 @@ find_remote_directories() {
 
        log_info "finding all git repos in $SERVER:$TARGET"
 
-       readarray -d '' repos < <("$SSH" "$SERVER" -- "$LS" "$TARGET" --zero)
+       readarray -d '' repos < <("$SSH" -o BatchMode=yes "$SERVER" -- "$LS" "$TARGET" --zero 2>/dev/null)
        
        for i in "${repos[@]}"; do
                set +e
                local target="$TARGET/${i}"
-               if [[ "true" == "$("$SSH" "$SERVER" -- "$GIT" -C "$target" rev-parse --is-bare-repository 2>&1)" ]]; then
+               if [[ "true" == "$("$SSH" -o BatchMode=yes "$SERVER" -- "$GIT" -C "$target" rev-parse --is-bare-repository 2>&1)" ]]; then
                        if [[ -d "$i" ]]; then
                                TO_FETCH+=("$SERVER:$target")
                        else