Search code examples
visual-studio-codewindows-7vscode-remote

Visual Studio Code Remote SSH uses Windows username instead of username in ssh_config


I'm using Visual Studio Code on Windows 7, along with Microsoft's Remote SSH extension. I added new remote host, and saved configuration in ssh_config file.

When I open that file, everything looks ok, both User and Host values. However, when extension asks me for a password, I can see that it doesn't use myuser@myremotehost.com , values that are written in ssh_config files, instead it uses proper host but it also uses my windows username instead of the username I set in ssh_config file.

Any solutions to that?


Solution

  • I found that including the username in the Host definition of the .ssh config file fixed it for me.

    Edit the contents of C:/Users/me/.ssh/config from:

    Host bar
      User foo
      HostName bar
      ForwardAgent yes
    

    to:

    Host foo@bar
      User foo
      HostName bar
      ForwardAgent yes