git_connect(): factor out SSH variant handling