SETUP I have a windows 10 PC connecting to my linux server (ubuntu 18.04.2). I run/edit code on my powerful server by remotely accessing the server through VS code's ssh ability. It is super convenient to edit my code on the server with VS code...
THE ISSUE
Visual Studio code won't connect to my Linux server. What is weird is that I am able to ssh into the server from the terminal within VScode by just literally typing ssh <username>@<server-hostname>
However, when I do the Remote-SSH option within VScode then it does not want to connect to the server...strange...
Here is how I remotely SSH into server with VScode built in functionality (marked with red rectangle). Also part of this screenshot is my config file, which I have triple checked as correct (IP address and .ssh/id_rsa_gpu_1_solarpv_ssh location)
HERE IS THE ERROR OUTPUT
MY ATTEMPTS
Still getting the error of failed to create hard link...
With all of my back-end stuff done right, I am absolutely clueless regarding why this is an issue.
Open the command panel (Ctrl+Shift+P for Windows and Cmd+Shift+P for Mac), search for Kill VS Code Server on Host, and locate the affected instance, which will be automatically cleared. Then, establish the connection again.
Add SSH key to your VMSelect Use existing public key in the dropdown for SSH public key source so that you can use the public key you just generated. Take the public key and paste it into your VM setup, by copying the entire contents of the id_ed25519.pub in the SSH public key.
In VS Code, select Remote-SSH: Connect to Host... from the Command Palette (F1, Ctrl+Shift+P) and use the same user@hostname as in step 1. If VS Code cannot automatically detect the type of server you are connecting to, you will be asked to select the type manually.
Open the command panel on VS code ( Ctrl+Shift+P for Windows and Cmd+Shift+P for Mac). Search for Kill VS Code Server on Host , click it - it will be automatically deleted. Reload VS Code and establish connection again.
After spending literally 9 hours on this issue...here is the answer:
When you launch VScode and remotely access the linux server, the linux server is instructed to download and install a vscode server so that you (on the other side) can remotely connect to the server.
If the server does not have internet just make sure the following setting is ticked
This allows the remote server (without or with internet connection) to get the vscode server running.
To eliminate the "failed to create hard link error" go to the directory mentioned by the error, which in this case on linux server is
navigate to /home/<username>/.vscode-server/bin/0ba0ca.../
then remove/delete the hardlink file and target file which also has the same name as the directory.
Here is also a discussion regarding the issue...if you still have problems https://github.com/microsoft/vscode-remote-release/issues/2507
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With