RemoteREPL cannot connect on Windows over SSH

I suspect that this is an ssh related problem:

I am trying to connect my Windows Laptop to a Julia session on a Linux cloud server using the RemoteREPL package (which uses an ssh tunnel). I started the RemoteREPL server on the Linux server with:

julia> using RemoteREPL

julia> @async serve_repl()
Task (runnable) @0x0000ffffb452a6d0

julia>

When I then try to connect from my windows laptop I get:

julia> using RemoteREPL

julia> connect_repl("luke")
┌ Warning: Tunnel output
│   errors =
└ @ RemoteREPL C:\Users\PC\.julia\packages\RemoteREPL\45M0w\src\tunnels.jl:31
┌ Error: Exceeded maximum socket connection attempts
└ @ RemoteREPL C:\Users\PC\.julia\packages\RemoteREPL\45M0w\src\tunnels.jl:87
ERROR: IOError: connect: connection refused (ECONNREFUSED)
Stacktrace:
 [1] wait_connected(x::Sockets.TCPSocket)
   @ Sockets C:\Users\PC\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Sockets\src\Sockets.jl:532
 [2] connect
   @ C:\Users\PC\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Sockets\src\Sockets.jl:567 [inlined]
 [3] connect
   @ C:\Users\PC\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Sockets\src\Sockets.jl:553 [inlined]
 [4] connect_via_tunnel(host::String, port::Int64; retry_timeout::Int64, tunnel::Symbol, ssh_opts::Cmd, region::Nothing, namespace::Nothing)
   @ RemoteREPL C:\Users\PC\.julia\packages\RemoteREPL\45M0w\src\tunnels.jl:80
 [5] setup_connection!(conn::RemoteREPL.Connection)
   @ RemoteREPL C:\Users\PC\.julia\packages\RemoteREPL\45M0w\src\client.jl:89
 [6] #Connection#34
   @ C:\Users\PC\.julia\packages\RemoteREPL\45M0w\src\client.jl:79 [inlined]
 [7] connect_repl(host::String, port::Int64; tunnel::Symbol, ssh_opts::Cmd, region::Nothing, namespace::Nothing, startup_text::Bool)
   @ RemoteREPL C:\Users\PC\.julia\packages\RemoteREPL\45M0w\src\client.jl:372
 [8] connect_repl(host::String, port::Int64) (repeats 2 times)
   @ RemoteREPL C:\Users\PC\.julia\packages\RemoteREPL\45M0w\src\client.jl:362
 [9] top-level scope
   @ REPL[2]:1

julia>

I have set up my ~/.ssh/config so that I can connect without a password (as the RemoteREPL docs state) using just:

ssh luke

from the Windows command line. I have noticed that connecting from the Windows command line is very slow (it takes 57s) compared with gitbash (which takes less than 2s). The above stack trace appears already after about 4s.

Any help/ideas will be appreciated :slightly_smiling_face:

I worked on this some more and eventually found that removing the line

ConnectTimeout 60

from my ~/.ssh/config solved the problem. Apparently the different versions of ssh interpret this differently. I now have RemoteREPL working as it should and fast login with the built in Windows version of ssh.