#!/bin/sh
# Which key exchange and host key algorithm do the big Git hosts negotiate with
# a stock OpenSSH client? No authentication happens: BatchMode makes the client
# give up at the login step, after key exchange is done.
# Client used for the post: OpenSSH_10.6p1, OpenSSL 3.5.9 (Git for Windows).
ssh -V 2>&1
date -u +"run at %Y-%m-%d %H:%M UTC"
for h in github.com gitlab.com bitbucket.org codeberg.org git.sr.ht; do
  printf '%s: ' "$h"
  timeout 15 ssh -vv -o BatchMode=yes -o StrictHostKeyChecking=no \
    -o UserKnownHostsFile=/dev/null -o ConnectTimeout=8 "git@$h" 2>&1 |
    grep -o 'kex: algorithm: .*\|kex: host key algorithm: .*' | tr '\n' ' '
  echo
done
