Fix VS Code Remote-SSH Repeated Verification Prompts with 2 Factor Authentication
In recent VSCode versions, Remote-SSH is better at asking for verification code automatically. If you are on an old version 2FA With VS Code Remote SSH will help.
Problem : VSCode Repeated 2FA verification prompts
Even with that I recently faced issue of repeated verification prompts when I was setting up the remote for the first time. You will observe that VS Server download process is running and asking you for verification code multiple times.
By default VS Code, Remote-SSH may try to download the VS Code Server directly on the remote machine first and on failure will try to do local install and ssh. And in remote machine download it probably tries repeated ssh connections and hence repeated verification (not entirely sure.).
A simple fix is to make VS code download it locally (if internet connection is present locally), then transfer it over SSH.
Steps:
Open VS Code Settings
Search for: Remote.SSH: Local Server Download
Change it from: auto to: always
