- Exit completely out of VSCode so that no VSCode processes are running. Force quit if you have to.
- ssh to the remote machine(s) and delete the ~/.vscode-server directory with rm -Rf ~/.vscode-server/
- If you get any “cannot remove [file]: Device or resource busy” errors then look for stuck processes:
- lsof | grep $HOME/.vscode-server | awk ‘{ print $2 }’ | sort -u
- … then kill those processes, then trying removing the directory again.
- Restart VSCode.
Reference: https://earlruby.org/2021/06/fixing-vscode-when-it-keeps-dropping-ssh-connections/