I want to SSH in VS Code from my local machine, A, through a proxy, B, to a destination host, C. And I have find there is a great discussion in . SSH from A through B to C, using private key on B [closed]. I followed what the best answer said, add some line in ~/.ssh/config:
Host C
ProxyCommand ssh -o 'ForwardAgent yes' B 'ssh-add && nc %h %p'
but it doesn't work, and raise a error Bad configuration option: 'forwardagent
.
I find there is only one single quote and guess maybe it's something wrong with quote, then I change all single quote to double quote, say:
Host C
ProxyCommand ssh -o "ForwardAgent yes" B "ssh-add && nc %h %p"
and it just worked.
I don't know why and very curious about this phenomenon.
I tried with several shells to test single/double quotes: double quoting is ok in each shell, but single quoting only worked on PowerShell but not work on cmd.
I have searched in google about the difference between single quote and double quote, and get about that they are different when treat text behind symbol "$". But still have no explanation for my question.
I really want to know why this little change makes my config work and why other people can also be good with the code mention in that discussion with single quote.