SSH timeouts on idle connections

On some remote machines my SSH connections hangs if they idle for a while. To get around that you can add a flag to send a keepalive signal reularly. Just open your ~/.ssh/config and add the following for the host that hangs:

Or to enable it for all hosts:

60 is the time in seconds between keepalive packages. Adjust this as needed.