The solution is to add some settings for SSH.
To do this, you need to add the following parameters to the ~/.ssh/config
file (the file may not exist, so you may need to create it):
Host *
ServerAliveInterval 600
TCPKeepAlive yes
IPQoS=throughput
After adding these parameters the error should disappear.