Claude Desktop SSH: "Timed out while waiting for handshake" - testSSHConnection succeeds but getSSHGitInfo always fails
Environment
- MacBook Air (client): macOS, Claude Desktop CCD v2.1.64
- Mac mini (server): macOS, Claude Code v2.1.72 (CLI)
- SSH: OpenSSH, Remote Login enabled, ed25519 + RSA keys configured
- Network: Local network (mDNS: KennoMac-mini.local)
Problem
Claude Desktop's SSH remote connection feature consistently fails with "Timed out while waiting for handshake" error.
Terminal SSH works perfectly: ssh kensmba@KennoMac-mini.local connects instantly and claude runs fine remotely.
What was tried (all failed)
- Updated Claude Code to latest on both machines
- Changed KEX algorithms — Modified
/etc/ssh/sshd_config.d/100-compat.confto restrict KEX to ssh2-compatible algorithms (curve25519-sha256, ecdh-sha2-nistp256, etc.) — Confirmed KEX changed frommlkem768x25519-sha256(post-quantum) tocurve25519-sha256viassh -vvv - Generated RSA 4096 key in addition to ed25519
- Configured SSH config alias (
~/.ssh/configwith Host mac-mini) - Tried multiple host formats: hostname, IP address, SSH config alias, with/without user@
- Added explicit Port 22 in sshd config
- Restricted HostKeyAlgorithms and PubkeyAcceptedAlgorithms to ssh2-compatible ones
- Restarted sshd via launchctl multiple times
Log Analysis (from ~/Library/Logs/Claude/main.log)
testSSHConnection: SSH connection test succeeded
getSSHGitInfo: Timed out while waiting for handshake
The internal flow shows:
testSSHConnection→ succeeds (SSH connectivity is fine)getSSHGitInfo→ always fails with handshake timeout
This suggests the issue is not with SSH connectivity itself, but with the secondary handshake that happens during getSSHGitInfo (possibly Claude Desktop's internal ssh2 Node.js library handling).
Hypothesis
Claude Desktop likely uses the Node.js ssh2 library internally (not the system's OpenSSH). Even after fixing KEX algorithms at the sshd level, the ssh2 library may have its own compatibility issues, or the getSSHGitInfo step may have a bug unrelated to SSH negotiation.
Expected Behavior
Claude Desktop should connect to Mac mini via SSH and allow remote Claude Code execution, since terminal SSH works perfectly.
Steps to Reproduce
- Set up two Macs on the same local network
- Enable Remote Login (sshd) on the target Mac
- Confirm terminal SSH works:
ssh user@target.local - Confirm Claude Code is installed on target:
claude --version - Open Claude Desktop → Settings → SSH → Add remote connection
- Enter hostname and user
- Observe: "Timed out while waiting for handshake"
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗